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

Row   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 0
dl 0
loc 25
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 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