DoctrineEvents::getShortEventType()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 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