GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Branch php72 (57c34e)
by Joni
05:01
created

BMPString   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 28
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A _validateString() 0 7 2
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace Sop\ASN1\Type\Primitive;
6
7
use Sop\ASN1\Type\PrimitiveString;
8
use Sop\ASN1\Type\UniversalClass;
9
10
/**
11
 * Implements <i>BMPString</i> type.
12
 *
13
 * BMP stands for Basic Multilingual Plane. This is generally an Unicode string
14
 * with UCS-2 encoding.
15
 */
16
class BMPString extends PrimitiveString
17
{
18
    use UniversalClass;
19
20
    /**
21
     * Constructor.
22
     *
23
     * @param string $string
24
     */
25 5
    public function __construct(string $string)
26
    {
27 5
        $this->_typeTag = self::TYPE_BMP_STRING;
28 5
        parent::__construct($string);
29 4
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 5
    protected function _validateString(string $string): bool
35
    {
36
        // UCS-2 has fixed with of 2 octets (16 bits)
37 5
        if (0 !== strlen($string) % 2) {
38 1
            return false;
39
        }
40 4
        return true;
41
    }
42
}
43