/**
  * @param DimensionsInterface $dimensions
  * @return Dimensions
  */
 public function normalize(DimensionsInterface $dimensions)
 {
     $values = [$dimensions->getLength()];
     if ($this->math->greaterThan($dimensions->getWidth(), reset($values))) {
         array_unshift($values, $dimensions->getWidth());
     } else {
         $values[] = $dimensions->getWidth();
     }
     if ($this->math->greaterThan($dimensions->getHeight(), reset($values))) {
         array_unshift($values, $dimensions->getHeight());
     } else {
         $values[] = $dimensions->getHeight();
     }
     $normalized = new Dimensions();
     $normalized->setUnit($dimensions->getUnit());
     $normalized->setLength(reset($values));
     $normalized->setWidth(next($values));
     $normalized->setHeight(next($values));
     return $normalized;
 }
<?php

use EsteIt\ShippingCalculator\Calculator\BaseCalculator;
use EsteIt\ShippingCalculator\CalculatorHandler\AramexCalculatorHandler;
use EsteIt\ShippingCalculator\Model\Weight;
use EsteIt\ShippingCalculator\Model\Dimensions;
use EsteIt\ShippingCalculator\Model\Address;
use EsteIt\ShippingCalculator\Model\Package;
include_once __DIR__ . '/../vendor/autoload.php';
$config = (include __DIR__ . '/../src/Resources/Aramex/tariff_2015_08_25_usa.php');
$calculator = new BaseCalculator(['handler' => AramexCalculatorHandler::create($config)]);
$weight = new Weight();
$weight->setValue(10);
$weight->setUnit('lb');
$dimensions = new Dimensions();
$dimensions->setLength(10);
$dimensions->setWidth(10);
$dimensions->setHeight(10);
$dimensions->setUnit('in');
$senderAddress = new Address();
$senderAddress->setCountryCode('USA');
$recipientAddress = new Address();
$recipientAddress->setCountryCode('IND');
$package = new Package();
$package->setCalculationDate(new \DateTime());
$package->setWeight($weight);
$package->setDimensions($dimensions);
$package->setSenderAddress($senderAddress);
$package->setRecipientAddress($recipientAddress);
$result = $calculator->calculate($package);
var_dump($result->getTotalCost());
 /**
  * @return \Closure
  */
 protected function createDimensionsNormalizer()
 {
     return function (Options $options, $value) {
         if (!$value instanceof DimensionsInterface) {
             $config = $value;
             $value = new Dimensions();
             $value->setLength(reset($config));
             $value->setWidth(next($config));
             $value->setHeight(next($config));
         }
         return $value;
     };
 }