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

Field   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 8
Bugs 1 Features 1
Metric Value
wmc 4
c 8
b 1
f 1
lcom 0
cbo 0
dl 0
loc 33
rs 10

3 Methods

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