Completed
Push — master ( a273fd...07370a )
by Oscar
07:06
created

Field::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 8
rs 9.4286
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace SimpleCrud\Fields;
4
5
use SimpleCrud\FieldInterface;
6
use SimpleCrud\Entity;
7
8
/**
9
 * Generic field. The data won't be converted.
10
 */
11
class Field implements FieldInterface
12
{
13
    protected $entity;
14
    protected $config = [];
15
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function __construct(Entity $entity, array $config = null)
20
    {
21
        $this->entity = $entity;
22
23
        if ($config !== null) {
24
            $this->config = $config;
25
        }
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function dataToDatabase($data)
32
    {
33
        return $data;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function dataFromDatabase($data)
40
    {
41
        return $data;
42
    }
43
}
44