Completed
Push — master ( 8c95bb...199f9c )
by Nate
15:05
created

Install::safeUp()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 0
crap 6
1
<?php
2
3
namespace flipbox\hubspot\migrations;
4
5
use craft\db\Migration as InstallMigration;
6
use flipbox\hubspot\HubSpot;
7
8
class Install extends InstallMigration
9
{
10
    /**
11
     * @inheritdoc
12
     */
13
    public function safeUp()
14
    {
15
        return $this->getContactSubMigration()->safeUp() &&
16
        $this->getCompanySubMigration()->safeUp();
17
    }
18
19
    /**
20
     * @inheritdoc
21
     */
22
    public function safeDown()
23
    {
24
        return $this->getContactSubMigration()->safeDown() &&
25
        $this->getCompanySubMigration()->safeDown();
26
    }
27
28
    /**
29
     * @return ObjectTable
30
     */
31
    private function getContactSubMigration()
32
    {
33
        return new ObjectTable([
34
            'tableAlias' => HubSpot::getInstance()->getSettings()->contactTableAlias
35
        ]);
36
    }
37
38
    /**
39
     * @return ObjectTable
40
     */
41
    private function getCompanySubMigration()
42
    {
43
        return new ObjectTable([
44
            'tableAlias' => HubSpot::getInstance()->getSettings()->companyTableAlias
45
        ]);
46
    }
47
}
48