Completed
Push — master ( 2181b4...d46ac5 )
by Oscar
03:08
created

AbstractEntity   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getName() 0 4 1
A getLabel() 0 4 1
1
<?php
2
3
namespace Folk\Entities;
4
5
use Folk\Admin;
6
7
/**
8
 * Base class extended by all entities.
9
 */
10
abstract class AbstractEntity implements EntityInterface
11
{
12
    protected $admin;
13
    protected $name;
14
15
    public $title;
16
    public $description;
17
18
    /**
19
     * {@inheritdoc}
20
     */
21
    public function __construct($name, Admin $admin)
22
    {
23
        $this->admin = $admin;
24
        $this->name = $name;
25
    }
26
27
    /**
28
     * {@inheritdoc}
29
     */
30
    public function getName()
31
    {
32
        return $this->name;
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function getLabel($id, array $data)
39
    {
40
        return current($data);
41
    }
42
}
43