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

HasParamsTrait::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace ByTIC\Migrations\Config\Traits;
4
5
/**
6
 * Trait HasParamsTrait
7
 * @package ByTIC\Migrations\Config\Traits
8
 */
9
trait HasParamsTrait
10
{
11
    protected $params = [];
12
13
    /**
14
     * @return null
15
     */
16
    public function getParams()
17
    {
18
        return $this->params;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->params returns the type array which is incompatible with the documented return type null.
Loading history...
19
    }
20
21
    /**
22
     * @param null $params
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $params is correct as it would always require null to be passed?
Loading history...
23
     */
24 1
    public function setParams($params)
25
    {
26 1
        $this->params = $params;
27 1
    }
28
29
    /**
30
     * @param $params
31
     */
32 2
    public function mergeParams($params)
33
    {
34 2
        $this->params = array_merge($this->params, $params);
35 2
    }
36
37
    /**
38
     * @return array
39
     */
40 5
    public function toArray()
41
    {
42 5
        return $this->params;
43
    }
44
45 8
    protected function generateBaseParams()
46
    {
47 8
        $this->params = [
48
            'paths' => [
49
                'migrations' => [],
50
                'seeds' => [],
51
            ],
52
            'environments' => [],
53
        ];
54
    }
55
}