Completed
Push — master ( e9e666...e79deb )
by Roni
01:22
created

DoctrineEvents   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 28
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getShortEventType() 0 4 1
A getConstants() 0 5 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.entity.';
17
18
    const ENTITY_UPDATED = 'easy_audit.doctrine.entity.updated';
19
    const ENTITY_CREATED = 'easy_audit.doctrine.entity.created';
20
    const ENTITY_DELETED = 'easy_audit.doctrine.entity.deleted';
21
22
23
    /**
24
     * @param string $eventName
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
     * @throws \ReflectionException
35
     */
36
    public static function getConstants()
37
    {
38
        $oClass = new \ReflectionClass(__CLASS__);
39
        return $oClass->getConstants();
40
    }
41
}
42