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

DeleteAsset::deleteAll()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
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