HasPathsTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 20%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 42
ccs 2
cts 10
cp 0.2
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A path() 0 3 1
A paths() 0 3 1
A initPaths() 0 3 1
A setPath() 0 3 1
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