Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
Cuboid
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 getVolume
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getSurface
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * Jingga
4 *
5 * PHP Version 8.1
6 *
7 * @package   phpOMS\Math\Geometry\Shape\D3
8 * @copyright Dennis Eichhorn
9 * @license   OMS License 2.0
10 * @version   1.0.0
11 * @link      https://jingga.app
12 */
13declare(strict_types=1);
14
15namespace phpOMS\Math\Geometry\Shape\D3;
16
17/**
18 * Cuboid shape.
19 *
20 * @package phpOMS\Math\Geometry\Shape\D3
21 * @license OMS License 2.0
22 * @link    https://jingga.app
23 * @since   1.0.0
24 */
25final class Cuboid implements D3ShapeInterface
26{
27    /**
28     * Volume
29     *
30     * @param float $a Edge
31     * @param float $b Edge
32     * @param float $h Height
33     *
34     * @return float
35     *
36     * @since 1.0.0
37     */
38    public static function getVolume(float $a, float $b, float $h) : float
39    {
40        return $a * $b * $h;
41    }
42
43    /**
44     * Surface area
45     *
46     * @param float $a Edge
47     * @param float $b Edge
48     * @param float $h Height
49     *
50     * @return float
51     *
52     * @since 1.0.0
53     */
54    public static function getSurface(float $a, float $b, float $h) : float
55    {
56        return 2 * ($a * $b + $a * $h + $b * $h);
57    }
58}