Completed
Push — master ( bcfab5...a273fd )
by Oscar
02:55
created

Field::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
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)
20
    {
21
        $this->entity = $entity;
22
    }
23
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function setConfig(array $config)
28
    {
29
        $this->config = $config;
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function getConfig()
36
    {
37
        return $this->config;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function dataToDatabase($data)
44
    {
45
        return $data;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function dataFromDatabase($data)
52
    {
53
        return $data;
54
    }
55
}
56