Completed
Branch master (b7eb35)
by Arnaud
02:59
created

AdminTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 36
ccs 4
cts 4
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
getUniqueEntity() 0 1 ?
A getPager() 0 4 1
A getUniqueEntityLabel() 0 4 1
1
<?php
2
3
namespace LAG\AdminBundle\Admin\Behaviors;
4
5
use Pagerfanta\Pagerfanta;
6
7
trait AdminTrait
8
{
9
    use EntityLabelTrait;
10
    use TranslationKeyTrait;
11
12
    /**
13
     * @var Pagerfanta
14
     */
15
    protected $pager;
16
17
    /**
18
     * Return the current unique entity.
19
     *
20
     * @return object
21
     */
22
    public abstract function getUniqueEntity();
23
24
    /**
25
     * @return Pagerfanta
26
     */
27 1
    public function getPager()
28
    {
29 1
        return $this->pager;
30
    }
31
32
    /**
33
     * Try to find a property to get a label from an entity. If found, it returns the property value through the
34
     * property accessor.
35
     *
36
     * @return string
37
     */
38 1
    public function getUniqueEntityLabel()
39
    {
40 1
        return $this->getEntityLabel($this->getUniqueEntity());
41
    }
42
}
43