SchemaHandler   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 11
dl 0
loc 34
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A logsSchemaUpdate() 0 10 2
A logsSchemaCreate() 0 10 2
1
<?php
2
3
namespace Norsys\LogsBundle\Composer;
4
5
use Sensio\Bundle\DistributionBundle\Composer\ScriptHandler;
6
use Composer\Script\Event;
7
8
/**
9
 * Class SchemaHandler
10
 */
11
class SchemaHandler extends ScriptHandler
12
{
13
    /**
14
     * Logs schema create
15
     *
16
     * @param Event $event
17
     */
18
    public static function logsSchemaCreate(Event $event)
19
    {
20
        $options = static::getOptions($event);
21
        $consoleDir = static::getConsoleDir($event, 'create logs schema');
22
23
        if (null === $consoleDir) {
24
            return;
25
        }
26
27
        static::executeCommand($event, $consoleDir, 'norsys:logs:schema-create --force', $options['process-timeout']);
28
    }
29
30
    /**
31
     * Logs schema create
32
     *
33
     * @param Event $event
34
     */
35
    public static function logsSchemaUpdate(Event $event)
36
    {
37
        $options = static::getOptions($event);
38
        $consoleDir = static::getConsoleDir($event, 'update logs schema');
39
40
        if (null === $consoleDir) {
41
            return;
42
        }
43
44
        static::executeCommand($event, $consoleDir, 'norsys:logs:schema-update --force', $options['process-timeout']);
45
    }
46
}
47