Completed
Branch feature/pre-split (67216b)
by Anton
03:22
created

MigrationsConfig   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 58
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getDirectory() 0 4 1
A getDatabase() 0 4 1
A getTable() 0 4 1
A isSafe() 0 4 1
1
<?php
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license MIT
6
 * @author  Anton Titov (Wolfy-J)
7
 */
8
namespace Spiral\Migrations\Configs;
9
10
use Spiral\Core\InjectableConfig;
11
12
class MigrationsConfig extends InjectableConfig
13
{
14
    /**
15
     * Configuration section.
16
     */
17
    const CONFIG = 'migrations';
18
19
    /**
20
     * @var array
21
     */
22
    protected $config = [
23
        'directory' => '',
24
        'database'  => 'default',
25
        'table'     => 'migrations',
26
        'safe'      => false
27
    ];
28
29
    /**
30
     * Migrations directory.
31
     *
32
     * @return string
33
     */
34
    public function getDirectory(): string
35
    {
36
        return $this->config['directory'];
37
    }
38
39
    /**
40
     * Database to store information about executed migration.
41
     *
42
     * @return string
43
     */
44
    public function getDatabase(): string
45
    {
46
        return $this->config['database'];
47
    }
48
49
    /**
50
     * Table to store list of executed migrations.
51
     *
52
     * @return string
53
     */
54
    public function getTable(): string
55
    {
56
        return $this->config['table'];
57
    }
58
59
    /**
60
     * Is it safe to run migration without user confirmation? Attention, this option does not
61
     * used in component directly and left for component consumers.
62
     *
63
     * @return bool
64
     */
65
    public function isSafe(): bool
66
    {
67
        return $this->config['safe'];
68
    }
69
}