HEX
Server: LiteSpeed
System: Linux server302.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: synqowzz (1256)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //proc/self/cwd/wp-content/plugins/pro-elements/modules/display-conditions/classes/or-condition.php
<?php

namespace ElementorPro\Modules\DisplayConditions\Classes;

class Or_Condition {
	/**
	 * @var $conditions_manager Object
	 */
	private $conditions_manager;

	/**
	 * @var $and_conditions And_Condition[]
	 */
	private $and_conditions;

	public function __construct( $conditions_manager, $sets ) {
		$this->conditions_manager = $conditions_manager;
		$this->set_and_conditions( $sets );
	}

	public function check() {
		if ( empty( $this->and_conditions ) ) {
			return true;
		}

		foreach ( $this->and_conditions as $condition ) {
			if ( $condition->check() ) {
				return true;
			}
		}

		return false;
	}

	private function set_and_conditions( $groups ) {
		$this->and_conditions = array_map( function ( $condition ) {
			return new And_Condition( $this->conditions_manager, $condition );
		}, $groups );
	}
}