Passed
Push — master ( b12b63...8e6e26 )
by Henri
08:15
created

DebugTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 18
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A debug() 0 13 3
1
<?php
2
3
namespace HnrAzevedo\Datamanager;
4
5
trait DebugTrait
6
{
7
    protected string $lastQuery = '';
8
    protected array $lastData = [];
9
10
    public function debug(bool $array = false)
11
    {
12
        if($array){
13
            return ['query' => $this->lastQuery, 'data' => $this->lastData];
14
        }
15
        
16
        $query = $this->lastQuery;
17
18
        foreach($this->lastData as $name => $value){
19
            $query = str_replace(":{$name}","'{$value}'",$query);
20
        }
21
22
        return $query;
23
    }    
24
25
    
26
27
}
28