UnsignedCharField   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Wowstack\Dbc\MappingField;
6
7
/**
8
 * Implements a field containing unsigned char values.
9
 */
10
class UnsignedCharField extends AbstractField implements MappingFieldInterface
11
{
12
    /**
13
     * Name of type.
14
     */
15
    const TYPE = 'uchar';
16
17
    /**
18
     * {@inheritdoc}
19
     */
20
    protected $size = 1;
21
22
    /**
23
     * Amount of fields to follow.
24
     *
25
     * @var int
26
     */
27
    protected $count = 0;
28
29
    /**
30
     * Defines required parameters.
31
     */
32
    const PARAMETERS = ['count'];
33
34
    /**
35
     * Defines optional parameters and their defaults.
36
     */
37
    const OPTIONAL_PARAMETERS = [];
38
39
    /**
40
     * Format used to pack/unpack this field type.
41
     */
42
    const PACK_FORMAT = 'C';
43
44
    /**
45
     * Constructs the field.
46
     *
47
     * @param string $name
48
     * @param array  $parameters
49
     *
50
     * @throws MappingException
51
     */
52 5
    public function __construct(string $name, array $parameters = [])
53
    {
54 5
        $this->name = $name;
55 5
        $this->setParameters($parameters);
56 4
        $this->setOptionalParameters($parameters);
57 4
    }
58
}
59