Passed
Push — develop ( dcecff...37402c )
by Septianata
16:01
created

Item   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 17
c 1
b 0
f 0
dl 0
loc 36
ccs 2
cts 2
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A countQuantityAttribute() 0 3 1
1
<?php
2
3
namespace App\Models;
4
5
use App\Infrastructure\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Factories\HasFactory;
7
8
class Item extends Model
9
{
10
    use HasFactory,
0 ignored issues
show
introduced by
The trait App\Models\Concerns\Item\Attribute requires some properties which are not provided by App\Models\Item: $name, $value
Loading history...
11
        Concerns\Item\Attribute,
12
        Concerns\Item\Event,
13
        Concerns\Item\QueryScope,
14
        Concerns\Item\Relation;
15
16
    /**
17
     * {@inheritDoc}
18
     */
19
    protected $fillable = [
20
        'quantity_per_bundle',
21
        'bundle_quantity',
22
        'quantity',
23
        'is_order_custom_quantity',
24
    ];
25
26
    /**
27
     * {@inheritDoc}
28
     */
29
    protected $casts = [
30
        'quantity_per_bundle' => 'integer',
31
        'bundle_quantity' => 'integer',
32
        'quantity' => 'integer',
33
        'is_order_custom_quantity' => 'boolean',
34
    ];
35
36
    /**
37
     * Count value of "quantity" attribute.
38
     *
39
     * @return int
40
     */
41 2
    public function countQuantityAttribute(): int
42
    {
43 2
        return $this->quantity_per_bundle * $this->bundle_quantity;
44
    }
45
}
46