HEX
Server: Apache
System: Linux c265a.dattaweb.com 4.18.0-553.97.1.el8_10.x86_64 #1 SMP Mon Jan 26 05:26:16 EST 2026 x86_64
User: c2650654 (20026)
PHP: 8.3.31
Disabled: system, shell, exec, system_exec, shell_exec, mysql_pconnect, passthru, popen, proc_open, proc_close, proc_nice, proc_terminate, proc_get_status, escapeshellarg, escapeshellcmd, eval, dl, imap_mail, libvirt_connect, gnupg_init, unsetenv, apache_setenv, pcntl_exec, pcntl_alarm, pcntl_fork, pcntl_waitpid, pcntl_wait, pcntl_wifexited, pcntl_wifstopped, pcntl_wifsignaled, pcntl_wifcontinued, pcntl_wexitstatus, pcntl_wtermsig, pcntl_wstopsig, pcntl_signal, pcntl_signal_get_handler, pcntl_signal_dispatch, pcntl_get_last_error, pcntl_strerror, pcntl_sigprocmask, pcntl_sigwaitinfo, pcntl_sigtimedwait, pcntl_getpriority, pcntl_setpriority, pcntl_async_signals, opcache_get_status, opcache_reset, opcache_get_configuration
Upload Files
File: /home/c2650654/public_html/wp-content/plugins/tier-pricing-table/src/PricingRule.php
<?php namespace TierPricingTable;

class PricingRule {
	
	protected $minimum = null;
	protected $rules = array();
	protected $type = 'fixed';
	protected $productId;
	
	public $provider = 'product';
	public $providerData = array();
	
	protected $modificationLog = array();
	
	public $data = array();
	
	public $customColumnsData = array();
	
	public $pricingData = array(
		'regular_price' => null,
		'sale_price'    => null,
		'discount'      => null,
		'pricing_type'  => null, // fixed or percentage
	);
	
	public function __construct( $productId ) {
		$this->productId = intval( $productId );
	}
	
	public function getProductId(): int {
		return $this->productId;
	}
	
	public function getMinimum( $forceValue = false ): ?int {
		
		if ( $forceValue ) {
			return $this->minimum ?: 1;
		}
		
		return $this->minimum;
	}
	
	public function setMinimum( ?int $minimum ) {
		$this->minimum = $minimum > 0 ? $minimum : null;
	}
	
	public function getRules(): array {
		return $this->rules;
	}
	
	public function setRules( array $rules ) {
		$this->rules = $rules;
	}
	
	public function getType(): string {
		return $this->type;
	}
	
	public function setType( string $type ) {
		$this->type = in_array( $type, array( 'fixed', 'percentage' ) ) ? $type : 'fixed';
	}
	
	public function isPercentage(): bool {
		return $this->getType() === 'percentage';
	}
	
	public function isFixed(): bool {
		return $this->getType() === 'fixed';
	}
	
	public function getTierPrice( $quantity, $withTaxes = true, $place = 'shop', $round = false ) {
		return PriceManager::getPriceByRules( $quantity, $this->getProductId(), 'view', $place, $withTaxes, $this,
			$round );
	}
	
	public function logPricingModification( string $modification ) {
		$this->modificationLog[] = $modification;
	}
	
	public function getPricingLog() {
		return $this->modificationLog;
	}
}