Completed
Push — master ( 1f4906...cc7288 )
by Vitaly
05:59
created

Row::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.4285
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 10.02.16 at 21:20
5
 */
6
namespace samsoncms\api\field;
7
8
/**
9
 * Additional fields table row.
10
 * This class is needed for generation of specific table row classes
11
 * with defined fields.
12
 *
13
 * @package samsoncms\api\field
14
 */
15
class Row
16
{
17
    /** @var array Field table row fields collection */
18
    protected $collection;
19
20
    /** @var int Material primary identifier */
21
    protected $primary;
22
23
    /**
24
     * Row constructor.
25
     *
26
     * @param int   $primary Material entity identifier
27
     * @param array $collection Collection of row additional field values
28
     */
29
    public function __construct($primary, array $collection)
30
    {
31
        $this->primary = $primary;
32
        $this->collection = $collection;
33
34
        // Set row fields
35
        foreach ($collection as $key => $value) {
36
            $this->$key = $value;
37
        }
38
    }
39
}
40