Passed
Push — next ( a64239...381d12 )
by Bas
06:24 queued 02:50
created

CanConfigureMigrationCommands   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 10
c 1
b 0
f 1
dl 0
loc 51
ccs 13
cts 13
cp 1
rs 10
wmc 9

4 Methods

Rating   Name   Duplication   Size   Complexity  
A shouldDropAnalyzers() 0 3 2
A setMigrationPaths() 0 13 3
A shouldDropAll() 0 3 2
A shouldDropGraphs() 0 3 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LaravelFreelancerNL\Aranguent\Testing\Concerns;
6
7
trait CanConfigureMigrationCommands
8
{
9
    /**
10
     * Determine if types should be dropped when refreshing the database.
11
     *
12
     * @return array<string, array<string>|string>
13
     */
14 29
    protected function setMigrationPaths()
15
    {
16 29
        $migrationSettings = [];
17
18 29
        if (property_exists($this, 'realPath')) {
19 29
            $migrationSettings['--realpath'] = $this->realPath ?? false;
20
        }
21
22 29
        if (property_exists($this, 'migrationPaths')) {
23 29
            $migrationSettings['--path'] = $this->migrationPaths;
24
        }
25
26 29
        return $migrationSettings;
27
    }
28
29
    /**
30
     * Determine if custom analyzers should be dropped when refreshing the database.
31
     *
32
     * @return bool
33
     */
34 30
    protected function shouldDropAnalyzers()
35
    {
36 30
        return property_exists($this, 'dropAnalyzers') ? $this->dropAnalyzers : false;
37
    }
38
39
    /**
40
     * Determine if graphs should be dropped when refreshing the database.
41
     *
42
     * @return bool
43
     */
44 30
    protected function shouldDropGraphs()
45
    {
46 30
        return property_exists($this, 'dropGraphs') ? $this->dropGraphs : false;
47
    }
48
49
50
    /**
51
     * Determine if all analyzers, graphs and views should be dropped when refreshing the database.
52
     *
53
     * @return bool
54
     */
55 30
    protected function shouldDropAll()
56
    {
57 30
        return property_exists($this, 'dropAll') ? $this->dropAll : false;
58
    }
59
}
60