/** * Calculate the required wrapping paper area for given box plus * the smallest side extra used for overlap * * @param Box $box * @return int|float */ public function calculateWrappingPaper(Box $box) { $top = $box->getLength() * $box->getWidth(); $side = $box->getWidth() * $box->getHeight(); $front = $box->getHeight() * $box->getLength(); $extra = min($top, $side, $front); return 2 * $top + 2 * $side + 2 * $front + $extra; }
public function testGetHeight() { $box = new Box(1, 1, 5); $height = $box->getHeight(); $this->assertEquals(5, $height); }