SCStatusRequest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 10
c 1
b 0
f 0
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A getMessageString() 0 8 1
1
<?php
2
3
namespace lordelph\SIP2\Request;
4
5
/**
6
 * SCStatusRequest message sends SC status to the ACS. It requires an ACS Status Response message reply from the
7
 * ACS. This message will be the first message sent by the SC to the ACS once a connection has been established
8
 * (exception: the Login Message may be sent first to login to an ACS server program). The ACS will respond with a
9
 * message that establishes some of the rules to be followed by the SC and establishes some parameters needed for
10
 * further communication.
11
 *
12
 * @method setStatus(string $status)
13
 * @method setWidth(string $width)
14
 * @method setVersion(string $version)
15
 *
16
 * @licence    https://opensource.org/licenses/MIT
17
 * @copyright  John Wohlers <[email protected]>
18
 * @copyright  Paul Dixon <[email protected]>
19
 */
20
class SCStatusRequest extends SIP2Request
21
{
22
    protected $var = [
23
        'Status' => ['default' => '0'],
24
        'Width' => ['default' => '80'],
25
        'Version' => ['default' => '2']
26
    ];
27
28 1
    public function getMessageString($withSeq = true, $withCrc = true): string
29
    {
30 1
        $this->newMessage('99');
31 1
        $this->addFixedOption($this->getVariable('Status'), 1);
32 1
        $this->addFixedOption($this->getVariable('Width'), 3);
33 1
        $this->addFixedOption(sprintf("%03.2f", (float)$this->getVariable('Version')), 4);
34
35 1
        return $this->returnMessage($withSeq, $withCrc);
36
    }
37
}
38