Completed
Push — dependabot/npm_and_yarn/vue-se... ( e78fac...845b60 )
by
unknown
358:07 queued 338:52
created

RenderingFields::fieldValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Thinktomorrow\Chief\Fields;
4
5
use Thinktomorrow\Chief\Fields\Types\Field;
6
7
trait RenderingFields
8
{
9 5
    public function renderField(Field $field)
10
    {
11 5
        return view($field->view(), array_merge([
0 ignored issues
show
Bug introduced by
It seems like $field->view() can also be of type Thinktomorrow\Chief\Fields\Types\Field; however, parameter $view of view() does only seem to accept null|string, maybe add an additional type check? ( Ignorable by Annotation )

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

11
        return view(/** @scrutinizer ignore-type */ $field->view(), array_merge([
Loading history...
12 5
            'field'           => $field,
13 5
            'key'             => $field->key(), // As parameter so that it can be altered for translatable values
0 ignored issues
show
Bug introduced by
The method key() does not exist on Thinktomorrow\Chief\Fields\Types\Field. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

13
            'key'             => $field->/** @scrutinizer ignore-call */ key(), // As parameter so that it can be altered for translatable values
Loading history...
14 5
            'manager'         => $this,
15 5
            'formElementView' => $field->formElementView(),
16 5
        ]), $field->viewData())->render();
0 ignored issues
show
Bug introduced by
It seems like $field->viewData() can also be of type Thinktomorrow\Chief\Fields\Types\Field; however, parameter $mergeData of view() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

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

16
        ]), /** @scrutinizer ignore-type */ $field->viewData())->render();
Loading history...
17
    }
18
19 5
    public function fieldValue(Field $field, $locale = null)
20
    {
21 5
        return $field->getFieldValue($this->model, $locale);
22
    }
23
}
24