Entry   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A save() 0 13 4
1
<?php
2
3
namespace Bavix\Entry\Models;
4
5
use Bavix\LaravelClickHouse\Database\Eloquent\Model;
6
use Bavix\Entry\Services\BulkService;
7
8
abstract class Entry extends Model
9
{
10
11
    /**
12
     * @inheritDoc
13
     */
14
    public function save(array $options = []): bool
15
    {
16
        if (\config('entry.saveViaQueue', false)) {
17
            return \app(BulkService::class)->insert($this);
0 ignored issues
show
Bug Best Practice introduced by
The expression return app(Bavix\Entry\S...::class)->insert($this) returns the type integer which is incompatible with the type-hinted return boolean.
Loading history...
18
        }
19
20
        foreach ($this->getAttributes() as $column => $value) {
21
            if ($value === null) {
22
                $this->$column = raw('NULL');
23
            }
24
        }
25
26
        return parent::save($options);
27
    }
28
29
}
30