Passed
Push — master ( d8cc68...c5f99b )
by Andrey
21:06 queued 05:59
created

Deletable   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 10
c 1
b 0
f 0
dl 0
loc 20
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 7 2
A delete() 0 9 3
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Traits\Processors;
4
5
use Helldar\LaravelLangPublisher\Constants\Status;
6
use Illuminate\Support\Facades\File as IlluminateFile;
7
8
trait Deletable
9 24
{
10
    public function run(): array
11
    {
12
        $this->delete()
13 24
            ? $this->push('*', Status::DELETED)
0 ignored issues
show
Bug introduced by
It seems like push() 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

13
            ? $this->/** @scrutinizer ignore-call */ push('*', Status::DELETED)
Loading history...
14 12
            : $this->push('*', Status::SKIPPED);
15 12
16
        return $this->result();
0 ignored issues
show
Bug introduced by
It seems like result() 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

16
        return $this->/** @scrutinizer ignore-call */ result();
Loading history...
17 24
    }
18
19
    protected function delete(): bool
20
    {
21
        if ($this->isProtected()) {
0 ignored issues
show
Bug introduced by
It seems like isProtected() 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

21
        if ($this->/** @scrutinizer ignore-call */ isProtected()) {
Loading history...
22
            return false;
23
        }
24
25
        return $this->wantsJson()
0 ignored issues
show
Bug introduced by
It seems like wantsJson() 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

25
        return $this->/** @scrutinizer ignore-call */ wantsJson()
Loading history...
26
            ? IlluminateFile::delete($this->targetPath())
0 ignored issues
show
Bug introduced by
It seems like targetPath() 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

26
            ? IlluminateFile::delete($this->/** @scrutinizer ignore-call */ targetPath())
Loading history...
27
            : IlluminateFile::deleteDirectory($this->targetPath());
28
    }
29
}
30