Completed
Push — master ( dd1269...21c3dd )
by Sam
02:11
created

Record::fill()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 2
b 0
f 0
nc 1
nop 2
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
3
namespace SPSS\Sav;
4
5
use SPSS\Buffer;
6
7
abstract class Record implements RecordInterface
8
{
9
    /**
10
     * Record constructor.
11
     *
12
     * @param array $data
13
     */
14 7
    public function __construct($data = [])
15
    {
16 7
        foreach ($data as $key => $value) {
17 5
            $this->{$key} = $value;
18
        }
19 7
    }
20
21
    /**
22
     * @param Buffer $buffer
23
     * @param array $data
24
     * @return static
25
     */
26 7
    public static function fill(Buffer $buffer, $data = [])
27
    {
28 7
        $record = new static($data);
29 7
        $record->read($buffer);
30
31 7
        return $record;
32
    }
33
34
    /**
35
     * @return array
36
     */
37
    public function toArray()
38
    {
39
        return [];
40
    }
41
}
42