Test Failed
Push — 0.6 ( 1e942f...a96f06 )
by Ben
05:42 queued 01:43
created

DeleteAsset   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A deleteAll() 0 3 1
A delete() 0 3 1
1
<?php
2
3
namespace Thinktomorrow\AssetLibrary\Application;
4
5
use Thinktomorrow\AssetLibrary\HasAsset;
6
use Thinktomorrow\AssetLibrary\Models\AssetLibrary;
7
8
class DeleteAsset
9
{
10
    /**
11
     * Removes an asset completely.
12
     *
13
     * @param $ids
14
     */
15
    public function delete($ids): void
16
    {
17
        AssetLibrary::removeByIds($ids);
18
    }
19
20
    /**
21
     * Removes all assets completely.
22
     *
23
     * @param $ids
24
     */
25
    public function deleteAll(HasAsset $model): void
26
    {
27
        $model->assetRelation->each->delete();
0 ignored issues
show
Bug introduced by
Accessing assetRelation on the interface Thinktomorrow\AssetLibrary\HasAsset suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
28
    }
29
}
30