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

Field   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 7
Bugs 1 Features 1
Metric Value
wmc 5
c 7
b 1
f 1
lcom 0
cbo 0
dl 0
loc 45
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A setConfig() 0 4 1
A getConfig() 0 4 1
A dataToDatabase() 0 4 1
A dataFromDatabase() 0 4 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