public function testParseDimensions()
 {
     $boxFactory = new BoxFactory();
     $box = $boxFactory->createBox("2x3x4");
     $this->assertEquals(2, $box->getWidth());
     $this->assertEquals(3, $box->getHeight());
     $this->assertEquals(4, $box->getLength());
 }
$options = getopt("f:vh");
$file = isset($options['f']) ? $options['f'] : "box-sizes.txt";
$verbose = (bool) isset($options['v']) ? true : false;
$help = (bool) isset($options['h']) ? true : false;
if ($help) {
    echo <<<HELP
Usage:
  php calculate-wrapping-paper.php [-f] <file> -v

  -f <file>   Parse file as having a box dimension on each line
  -v          Verbose
HELP;
}
require_once __DIR__ . '/vendor/autoload.php';
$totalSurfaceArea = 0;
$wrapCalculator = new WrapCalculator();
$boxFactory = new BoxFactory();
$handle = fopen($file, "r");
while (false !== ($line = fgets($handle, 4096))) {
    $line = trim($line);
    $box = $boxFactory->createBox($line);
    $surfaceArea = $wrapCalculator->getTotalSurfaceArea($box);
    $totalSurfaceArea += $surfaceArea;
    if ($verbose) {
        $verboseOutput = "Dimensions: %' 9s, Total Surface Area: %d";
        echo sprintf($verboseOutput, $line, $surfaceArea) . PHP_EOL;
    }
}
fclose($handle);
$output = "Total Surface Area is: %s sq ft";
echo sprintf($output, number_format($totalSurfaceArea)) . PHP_EOL;