Completed
Push — extensions-support ( 10d6ff...e9c539 )
by Guido
04:09
created

ClosureTable::getValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 7
ccs 2
cts 2
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace LaravelDoctrine\Fluent\Extensions\Gedmo;
4
5
use Gedmo\Tree\Entity\Repository\ClosureTreeRepository;
6
use LaravelDoctrine\Fluent\Buildable;
7
use LaravelDoctrine\Fluent\Fluent;
8
9
class ClosureTable extends TreeStrategy implements Buildable
10
{
11
    /**
12
     * @var string
13
     */
14
    private $closureClass;
15
16
    /**
17
     * ClosureTable constructor.
18
     *
19
     * @param Fluent $builder
20
     * @param string $class
21
     */
22 2
    public function __construct(Fluent $builder, $class)
23
    {
24 2
        parent::__construct($builder);
25 2
26
        $this->closureClass = $class;
27
    }
28
29
    /**
30 1
     * Execute the build process
31
     */
32
    public function build()
33 1
    {
34
        $this->builder->entity()->setRepositoryClass(ClosureTreeRepository::class);
35 1
36 1
        parent::build();
37 1
    }
38 1
39
    /**
40
     * {@inheritdoc}
41
     */
42
    protected function getValues()
43 1
    {
44
        return array_merge(parent::getValues(), [
45 1
            'strategy' => 'closure',
46
            'closure'  => $this->closureClass,
47
        ]);
48
    }
49
50
}
51