HasItemMovements   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A stock() 0 3 1
A rollback() 0 5 1
1
<?php
2
3
namespace Ronmrcdo\Inventory\Traits;
4
5
use Illuminate\Database\Eloquent\Relations\BelongsTo;
6
7
trait HasItemMovements
8
{
9
	/**
10
     * Rolls back the current movement.
11
     *
12
     * @param bool $recursive
13
     *
14
     * @return mixed
15
     */
16
    public function rollback($recursive = false)
17
    {
18
        $stock = $this->stock;
19
20
        return $stock->rollback($this, $recursive);
21
	}
22
23
	/**
24
     * Stock relation
25
     * 
26
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
27
     */
28
    public function stock(): BelongsTo
29
    {
30
        return $this->belongsTo('Ronmrcdo\Inventory\Models\InventoryStock', 'stock_id', 'id');
0 ignored issues
show
Bug introduced by
It seems like belongsTo() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

30
        return $this->/** @scrutinizer ignore-call */ belongsTo('Ronmrcdo\Inventory\Models\InventoryStock', 'stock_id', 'id');
Loading history...
31
    }
32
}