Passed
Push — master ( af710d...2c0b17 )
by Dan Michael O.
08:29
created

NeverLoanedOut   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A passes() 0 3 1
A message() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
namespace App\Rules;
4
5
use App\Item;
6
use Illuminate\Contracts\Validation\Rule;
0 ignored issues
show
Bug introduced by
The type Illuminate\Contracts\Validation\Rule was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use function Stringy\create as s;
0 ignored issues
show
introduced by
The function Stringy\create was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
8
9
class NeverLoanedOut implements Rule
10
{
11
    protected $item;
12
13
    /**
14
     * Create a new rule instance.
15
     *
16
     * @param Item $item
17
     */
18
    public function __construct(Item $item)
19
    {
20
        $this->item = $item;
21
    }
22
23
    /**
24
     * Determine if the validation rule passes.
25
     *
26
     * @param  string  $attribute
27
     * @param  mixed  $value
28
     * @return bool
29
     */
30
    public function passes($attribute, $value)
31
    {
32
        return false;
33
    }
34
35
    /**
36
     * Get the validation error message.
37
     *
38
     * @return string
39
     */
40
    public function message()
41
    {
42
        return sprintf(
43
            '%s har egentlig aldri vært utlånt så vidt Bibrex kan se.',
44
            s($this->item->thing->properties->get('name_definite.nob'))->upperCaseFirst()
0 ignored issues
show
Bug introduced by
The function create was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
            /** @scrutinizer ignore-call */ 
45
            s($this->item->thing->properties->get('name_definite.nob'))->upperCaseFirst()
Loading history...
45
        );
46
    }
47
}
48