Cancelled
Branch master (8cb5b2)
by Christopher
04:16
created

IsModelSearchable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 19
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A isModelSearchable() 0 9 2
1
<?php
0 ignored issues
show
Coding Style introduced by
This file is missing a doc comment.
Loading history...
Coding Style introduced by
The PHP open tag does not have a corresponding PHP close tag
Loading history...
2
namespace Triadev\Leopard\Business\Helper;
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
4
use Illuminate\Database\Eloquent\Model;
5
use Triadev\Leopard\Searchable;
6
7
trait IsModelSearchable
0 ignored issues
show
Coding Style introduced by
Missing class doc comment
Loading history...
8
{
0 ignored issues
show
Coding Style introduced by
Opening brace should be on the same line as the declaration for trait IsModelSearchable
Loading history...
9
    /**
10
     * Is model searchable
11
     *
12
     * @param Model $model
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Tag value indented incorrectly; expected 2 spaces but found 1
Loading history...
13
     * @return true
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
14
     *
15
     * @throws \InvalidArgumentException
0 ignored issues
show
introduced by
Comment missing for @throws tag in function comment
Loading history...
16
     */
17 17
    public function isModelSearchable(Model $model) : bool
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
18
    {
19 17
        $traits = class_uses_recursive(get_class($model));
20
        
21 17
        if (!isset($traits[Searchable::class])) {
0 ignored issues
show
Coding Style introduced by
There must be a single space after a NOT operator; 0 found
Loading history...
22 3
            throw new \InvalidArgumentException(get_class($model).' does not use the searchable trait.');
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 100 characters; contains 105 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
23
        }
24
        
25 14
        return true;
26
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
Coding Style introduced by
Expected 1 blank line before closing function brace; 0 found
Loading history...
Coding Style introduced by
Expected //end isModelSearchable()
Loading history...
27
}
0 ignored issues
show
Coding Style introduced by
As per coding style, files should not end with a newline character.

This check marks files that end in a newline character, i.e. an empy line.

Loading history...
28