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

Field::getConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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