TextareaComponent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 1
c 1
b 0
f 1
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace SoareCostin\BladeFormComponents\FormComponents;
4
5
use Illuminate\Contracts\Support\Htmlable;
6
use SoareCostin\BladeFormComponents\FormElements\Textarea;
7
8
class TextareaComponent implements Htmlable
9
{
10
    /** @var \SoareCostin\BladeFormComponents\FormElements\Textarea */
11
    protected $element;
12
13
    public function __construct(array $params = [])
14
    {
15
        $this->element = new Textarea($params);
16
    }
17
18
    public function toHtml()
19
    {
20
        return view(
21
            'blade-form-components::textarea', [
22
                'element' => $this->element,
23
                'theme' => $this->element->getTheme(),
24
                'id' => $this->element->getId(),
25
            ]
26
        )->withErrors($this->element->getErrors());
0 ignored issues
show
Bug introduced by
$this->element->getErrors() of type Illuminate\Support\ViewErrorBag is incompatible with the type Illuminate\Contracts\Support\MessageProvider|array expected by parameter $provider of Illuminate\View\View::withErrors(). ( Ignorable by Annotation )

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

26
        )->withErrors(/** @scrutinizer ignore-type */ $this->element->getErrors());
Loading history...
27
    }
28
}
29