Database   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A send() 0 16 2
A check() 0 3 1
1
<?php 
2
3
namespace Yaro\LogEnvelope\Drivers;
4
5
use Yaro\LogEnvelope\Models\ExceptionModel;
6
7
class Database extends AbstractDriver
8
{
9
    protected function check() 
10
    {
11
        return $this->isEnabled();
12
    }
13
    
14
    public function send()
15
    {
16
        if (!$this->check()) {
17
            return;
18
        }
19
        
20
        $data = $this->data;
21
        
22
        $data['exegutor'] = implode('<br>', array_map($data['exegutor'], function ($item) {
0 ignored issues
show
Bug introduced by
function(...) { /* ... */ } of type callable is incompatible with the type array expected by parameter $array of array_map(). ( Ignorable by Annotation )

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

22
        $data['exegutor'] = implode('<br>', array_map($data['exegutor'], /** @scrutinizer ignore-type */ function ($item) {
Loading history...
23
            return $item['wrap_left'] . $item['line'] . $item['wrap_right'];
24
        }));
25
        $data['lines'] = implode("\n", $data['lines']);
26
        $data['storage'] = json_encode($data['storage']);
27
28
        $model = $this->config['model'];
29
        $model::create($data);
30
    }
31
}
32