Passed
Push — master ( 472b4c...8e27d6 )
by Gabriel
04:44
created

HasPathsTrait::setPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace ByTIC\Migrations\Migrator\Traits;
4
5
use ByTIC\Migrations\Utility\Helper;
6
7
/**
8
 * Trait HasPathsTrait
9
 * @package ByTIC\Migrations\Migrator\Traits
10
 */
11
trait HasPathsTrait
12
{
13
14
    /**
15
     * Register a custom migration path.
16
     *
17
     * @param string $path
18
     * @param string $type
19
     */
20
    public function path($path, $type = 'migrations')
21
    {
22
        $this->getConfig()->path($path, $type);
0 ignored issues
show
Bug introduced by
It seems like getConfig() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
        $this->/** @scrutinizer ignore-call */ 
23
               getConfig()->path($path, $type);
Loading history...
23
    }
24
25
    /**
26
     * Register a custom migration path.
27
     *
28
     * @param string $path
29
     * @param string $type
30
     */
31
    public function setPath($path, $type = 'migrations')
32
    {
33
        $this->getConfig()->setPath($path, $type);
34
    }
35
36
    /**
37
     * Get all of the custom migration paths.
38
     *
39
     * @param string $type
40
     * @return array
41
     */
42 1
    public function paths($type = 'migrations')
43
    {
44 1
        return $this->getConfig()->paths($type);
45
    }
46
47
    /**
48
     * @param string $type
49
     */
50
    protected function initPaths($type = 'migrations')
51
    {
52
        $this->getConfig()->initPaths($type);
53
    }
54
}
55