DoctrineEvents   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 27
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getShortEventType() 0 3 1
A getConstants() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the XiideaEasyAuditBundle package.
5
 *
6
 * (c) Xiidea <http://www.xiidea.net>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace Xiidea\EasyAuditBundle\Events;
13
14
class DoctrineEvents
15
{
16
    private static $prefix = 'easy_audit.doctrine.object.';
17
18
    const ENTITY_UPDATED = 'easy_audit.doctrine.object.updated';
19
    const ENTITY_CREATED = 'easy_audit.doctrine.object.created';
20
    const ENTITY_DELETED = 'easy_audit.doctrine.object.deleted';
21
22
    /**
23
     * @param string $eventName
24
     *
25
     * @return string
26
     */
27
    public static function getShortEventType($eventName)
28
    {
29
        return str_replace(self::$prefix, '', $eventName);
30
    }
31
32
    /**
33
     * @return array
34
     *
35
     * @throws \ReflectionException
36
     */
37
    public static function getConstants()
38
    {
39
        $oClass = new \ReflectionClass(__CLASS__);
40
        return $oClass->getConstants();
41
    }
42
}
43