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

RenderingFields   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
dl 0
loc 15
ccs 9
cts 9
cp 1
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A renderField() 0 8 1
A fieldValue() 0 3 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