Code Duplication    Length = 38-38 lines in 2 locations

src/Extensions/Gedmo/ClosureTable.php 1 location

@@ 10-47 (lines=38) @@
7
use LaravelDoctrine\Fluent\Extensions\ExtensibleClassMetadata;
8
use LaravelDoctrine\Fluent\Fluent;
9
10
class ClosureTable implements Buildable
11
{
12
    /**
13
     * @var Fluent
14
     */
15
    private $builder;
16
17
    /**
18
     * ClosureTable constructor.
19
     *
20
     * @param Fluent $builder
21
     */
22
    public function __construct(Fluent $builder)
23
    {
24
        $this->builder = $builder;
25
    }
26
27
    /**
28
     * Execute the build process
29
     */
30
    public function build()
31
    {
32
        /** @var ExtensibleClassMetadata $classMetadata */
33
        $classMetadata = $this->builder->getBuilder()->getClassMetadata();
34
35
        $classMetadata->appendExtension($this->getExtensionName(), [
36
            'strategy' => 'closure',
37
        ]);
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    protected function getExtensionName()
44
    {
45
        return TreeDriver::EXTENSION_NAME;
46
    }
47
}
48

src/Extensions/Gedmo/MaterializedPath.php 1 location

@@ 10-47 (lines=38) @@
7
use LaravelDoctrine\Fluent\Extensions\ExtensibleClassMetadata;
8
use LaravelDoctrine\Fluent\Fluent;
9
10
class MaterializedPath implements Buildable
11
{
12
    /**
13
     * @var Fluent
14
     */
15
    private $builder;
16
17
    /**
18
     * MaterializedPath constructor.
19
     *
20
     * @param Fluent $builder
21
     */
22
    public function __construct(Fluent $builder)
23
    {
24
        $this->builder = $builder;
25
    }
26
27
    /**
28
     * Execute the build process
29
     */
30
    public function build()
31
    {
32
        /** @var ExtensibleClassMetadata $classMetadata */
33
        $classMetadata = $this->builder->getBuilder()->getClassMetadata();
34
35
        $classMetadata->appendExtension($this->getExtensionName(), [
36
            'strategy' => 'materializedPath',
37
        ]);
38
    }
39
40
    /**
41
     * @return string
42
     */
43
    protected function getExtensionName()
44
    {
45
        return TreeDriver::EXTENSION_NAME;
46
    }
47
}
48