Completed
Push — 1.1 ( d166b0...e7f438 )
by Patrick
11:31 queued 07:46
created

Blameable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A enable() 0 10 1
A getExtensionName() 0 4 1
1
<?php
2
3
namespace LaravelDoctrine\Fluent\Extensions\Gedmo;
4
5
use Gedmo\Blameable\Mapping\Driver\Fluent;
6
use LaravelDoctrine\Fluent\Buildable;
7
use LaravelDoctrine\Fluent\Builders\Field;
8
use LaravelDoctrine\Fluent\Extensions\Extension;
9
use LaravelDoctrine\Fluent\Relations\ManyToOne;
10
11
class Blameable extends AbstractTrackingExtension implements Buildable, Extension
12
{
13
    const MACRO_METHOD = 'blameable';
14
15
    /**
16
     * Enable the extension.
17
     *
18
     * @return void
19
     */
20
    public static function enable()
21
    {
22
        Field::macro(self::MACRO_METHOD, function (Field $builder) {
23
            return new static($builder->getClassMetadata(), $builder->getName());
24
        });
25
26
        ManyToOne::macro(self::MACRO_METHOD, function (ManyToOne $builder) {
27
            return new static($builder->getClassMetadata(), $builder->getRelation());
28
        });
29
    }
30
31
    /**
32
     * Return the name of the actual extension.
33
     *
34
     * @return string
35
     */
36
    protected function getExtensionName()
37
    {
38
        return Fluent::EXTENSION_NAME;
39
    }
40
}
41