![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /var/www/theprintave/wp-content/plugins/dokan-lite/includes/Commission/ |
<?php namespace WeDevs\Dokan\Commission; use WeDevs\Dokan\Commission\Formula\CategoryBased; use WeDevs\Dokan\Commission\Formula\Combine; use WeDevs\Dokan\Commission\Formula\Fixed; use WeDevs\Dokan\Commission\Formula\Flat; use WeDevs\Dokan\Commission\Formula\AbstractFormula; use WeDevs\Dokan\Commission\Formula\Percentage; use WeDevs\Dokan\Commission\Model\Setting; use WeDevs\Dokan\Commission\Settings\DefaultSetting; /** * This is the factory class that determines the commission formula. * * @since 3.14.0 */ class FormulaFactory { /** * Returns the applicable formula class or null. * * @since 3.14.0 * * @param \WeDevs\Dokan\Commission\Model\Setting $settings * * @return \WeDevs\Dokan\Commission\Formula\AbstractFormula */ public static function get_formula( Setting $settings ): AbstractFormula { switch ( $settings->get_type() ) { case Flat::SOURCE: // In Dokan before 3.14.0 version if the commission type was flat the flat value used to be saved in the percentage key, that is why we are passing the percentage value. return new Flat( $settings ); case Percentage::SOURCE: return new Percentage( $settings ); case Combine::SOURCE: // Assuming 'combine' implies a combination of flat + percentage return new Combine( $settings ); case Fixed::SOURCE: return new Fixed( $settings ); case CategoryBased::SOURCE: return new CategoryBased( $settings ); default: $default_setting = new DefaultSetting(); return new Percentage( $default_setting->get() ); } } }