Sindbad~EG File Manager

Current Path : /home/n/i/c/nicedoo/www/wp-content/plugins/tier-pricing-table/src/
Upload File :
Current File : /home/n/i/c/nicedoo/www/wp-content/plugins/tier-pricing-table/src/PricingRule.php

<?php namespace TierPricingTable;

class PricingRule {
	
	protected $minimum = 1;
	protected $rules = array();
	protected $type = 'fixed';
	protected $productId;
	
	public $provider = 'product';
	public $providerData = array();
	
	public $data = array();
	
	public $customColumnsData = array();
	
	public $pricingData = array(
		'regular_price' => null,
		'sale_price'    => null,
		'discount'      => null,
		// fixed or percentage
		'pricing_type'  => null,
	);
	
	public $cartItemData = array(
		'new_price'           => null,
		'total_item_quantity' => null,
	);
	
	public function __construct( $productId ) {
		$this->productId = intval( $productId );
	}
	
	public function getProductId(): int {
		return $this->productId;
	}
	
	public function getMinimum(): int {
		return $this->minimum;
	}
	
	public function setMinimum( $minimum ) {
		$this->minimum = intval( $minimum ) > 0 ? intval( $minimum ) : 1;
	}
	
	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 = null ) {
		return PriceManager::getPriceByRules( $quantity, $this->getProductId(), 'view', $place, $withTaxes, $this,
			$round );
	}
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists