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

Recognizable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A recognize() 0 3 1
A recognition() 0 3 1
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