Passed
Push — master ( 46d1b1...50282e )
by Chris
91:01
created

Recognizable::recognize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Meema\MediaRecognition\Traits;
4
5
use Meema\MediaRecognition\Facades\Recognize;
6
use Meema\MediaRecognition\Models\MediaRecognition;
7
8
trait Recognizable
9
{
10
    /**
11
     * Get all of the media items' conversions.
12
     */
13
    public function recognition()
14
    {
15
        return $this->morphOne(MediaRecognition::class, 'model');
0 ignored issues
show
Bug introduced by
It seems like morphOne() 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

15
        return $this->/** @scrutinizer ignore-call */ morphOne(MediaRecognition::class, 'model');
Loading history...
16
    }
17
18
    /**
19
     * Start a media "recognition".
20
     *
21
     * @param string $path
22
     * @param string|null $mimeType
23
     * @return \Meema\MediaRecognition\Contracts\MediaRecognition
24
     */
25
    public function recognize(string $path, string $mimeType = null)
26
    {
27
        return Recognize::source($path, $mimeType, $this->id);
28
    }
29
}
30