Bin   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 58
c 0
b 0
f 0
wmc 5
lcom 1
cbo 0
ccs 12
cts 12
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setData() 0 6 1
A getData() 0 4 1
A toString() 0 4 1
A __toString() 0 4 1
1
<?php
2
3
namespace Fhp\DataTypes;
4
5
/**
6
 * Class Bin
7
 * @package Fhp\DataTypes
8
 */
9
class Bin
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $string;
15
16
    /**
17
     * Bin constructor.
18
     *
19
     * @param string $string
20
     */
21 5
    public function __construct($string)
22
    {
23 5
        $this->string = $string;
24 5
    }
25
26
    /**
27
     * Sets the binary data.
28
     *
29
     * @param string $data
30
     * @return $this
31
     */
32 1
    public function setData($data)
33
    {
34 1
        $this->string = $data;
35
36 1
        return $this;
37
    }
38
39
    /**
40
     * Gets the binary data.
41
     *
42
     * @return string
43
     */
44 5
    public function getData()
45
    {
46 5
        return $this->string;
47
    }
48
49
    /**
50
     * Convert to string.
51
     *
52
     * @return string
53
     */
54 3
    public function toString()
55
    {
56 3
        return '@' . strlen($this->string) . '@' . $this->string;
57
    }
58
59
    /**
60
     * @return string
61
     */
62 3
    public function __toString()
63
    {
64 3
        return $this->toString();
65
    }
66
}
67