GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

DbExportHandler   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 111
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 3
dl 0
loc 111
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A migrate() 0 6 1
A seed() 0 6 1
A migrateAndSeed() 0 10 1
A ignore() 0 6 1
A getMigrationsFilePath() 0 4 1
A uploadTo() 0 6 1
1
<?php
2
3
namespace Elimuswift\DbExporter;
4
5
class DbExportHandler
6
{
7
    /**
8
     * @var DbMigrations
9
     */
10
    protected $migrator;
11
12
    /**
13
     * @var DbSeeding
14
     */
15
    protected $seeder;
16
17
    /**
18
     * Inject the DbMigrations class.
19
     *
20
     * @param DbMigrations $DbMigrations
21
     * @param DbSeeding    $DbSeeding
22
     */
23
    public function __construct(DbMigrations $DbMigrations, DbSeeding $DbSeeding)
24
    {
25
        $this->migrator = $DbMigrations;
26
        $this->seeder = $DbSeeding;
27
    }
28
29
//end __construct()
30
31
    /**
32
     * Create migrations from the given DB.
33
     *
34
     * @param string null $database
35
     *
36
     * @return $this
37
     */
38
    public function migrate($database = null)
39
    {
40
        $this->migrator->convert($database)->write();
41
42
        return $this;
43
    }
44
45
//end migrate()
46
47
    /**
48
     * @param null $database
49
     *
50
     * @return $this
51
     */
52
    public function seed($database = null)
53
    {
54
        $this->seeder->convert($database)->write();
55
56
        return $this;
57
    }
58
59
//end seed()
60
61
    /**
62
     * Helper function to generate the migration and the seed in one command.
63
     *
64
     * @param null $database
65
     *
66
     * @return $this
67
     */
68
    public function migrateAndSeed($database = null)
69
    {
70
        // Run the migrator generator
71
        $this->migrator->convert($database)->write();
72
73
        // Run the seeder generator
74
        $this->seeder->convert($database)->write();
75
76
        return $this;
77
    }
78
79
//end migrateAndSeed()
80
81
    /**
82
     * Add tables to the ignore array.
83
     *
84
     * @param $tables
85
     *
86
     * @return $this
87
     */
88
    public function ignore(...$tables)
89
    {
90
        DbExporter::$ignore = array_merge(DbExporter::$ignore, (array)$tables);
91
92
        return $this;
93
    }
94
95
//end ignore()
96
97
    /**
98
     * @return mixed
99
     */
100
    public function getMigrationsFilePath()
101
    {
102
        return DbMigrations::$filePath;
103
    }
104
105
//end getMigrationsFilePath()
106
107
    public function uploadTo($remote)
108
    {
109
        DbExporter::$remote = $remote;
110
111
        return $this;
112
    }
113
114
//end uploadTo()
115
}//end class
116