Completed
Push — master ( a5ebf2...e4aa7b )
by Patrick
01:20
created

VibratingString   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 33
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getFrequency() 0 4 1
A getPhysicalLength() 0 4 1
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace ExtendedStrings\Strings;
6
7
class VibratingString implements VibratingStringInterface
8
{
9
    private $frequency;
10
    private $physicalLength;
11
12
    /**
13
     * VibratingString constructor.
14
     *
15
     * @param float $frequency      The open string frequency (in Hz).
16
     * @param float $physicalLength The physical length of the string (in mm).
17
     */
18
    public function __construct(float $frequency, float $physicalLength = 500.0)
19
    {
20
        $this->frequency = $frequency;
21
        $this->physicalLength = $physicalLength;
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function getFrequency(): float
28
    {
29
        return $this->frequency;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function getPhysicalLength(): float
36
    {
37
        return $this->physicalLength;
38
    }
39
}
40