Passed
Push — master ( 8c568b...a82e5e )
by Simon Montoya
02:44
created

Field::highlightsLabel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Saimondev03;
4
5
use Illuminate\Config\Repository;
6
use Illuminate\View\Component;
7
8
class Field extends Component
9
{
10
    /**
11
     * @var string
12
     */
13
    public $name;
14
15
    /**
16
     * @var true\mixed
0 ignored issues
show
Bug introduced by
The type Saimondev03\true\mixed 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...
17
     */
18
    public $label;
19
20
    /**
21
     * @var false|mixed
22
     */
23
    public $required;
24
    /**
25
     * @var Repository
26
     */
27
    private $config;
28
29
    public function __construct(Repository $config, string $name, $required = false, $label = true)
30
    {
31
        $this->name = $name;
32
        $this->required = $required;
33
        $this->label = $label;
34
        $this->config = $config;
35
    }
36
37
    public function highlightsRequired()
38
    {
39
        return $this->config->get('form.highlights_requirement') === 'required' && $this->required;
40
    }
41
42
    public function highlightsOptional()
43
    {
44
        return $this->config->get('form.highlights_requirement') === 'optional' && ! $this->required;
45
    }
46
47
    public function highlightsLabel()
48
    {
49
        //dd($this->label);
50
        return $this->label === true;
51
    }
52
53
    public function render()
54
    {
55
        return view('saimondev03-form::field');
56
    }
57
}
58