HasGroupDescription::useFieldForDescription()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace NovaFlexibleContent\Layouts\LayoutTraits;
4
5
trait HasGroupDescription
6
{
7
    /**
8
     * @deprecated Please use "fieldUsedForDescription"
9
     */
10
    protected ?string $tagInfoFrom = null;
11
12
    /**
13
     * Display description for specific group in array of groups with same layout.
14
     *
15
     * @var string|null
16
     */
17
    protected ?string $fieldUsedForDescription = null;
18
19
    /**
20
     * @param string|null $fieldUsedForDescription
21
     *
22
     * @return static
23
     */
24 1
    public function useFieldForDescription(?string $fieldUsedForDescription = null): static
25
    {
26 1
        $this->fieldUsedForDescription = $fieldUsedForDescription;
27
28 1
        return $this;
29
    }
30
31
32
    /**
33
     * Returns field name what used for describe group.
34
     *
35
     * @return string|null
36
     */
37 2
    public function fieldUsedForDescription(): ?string
38
    {
39 2
        return $this->fieldUsedForDescription ?? $this->tagInfoFrom;
0 ignored issues
show
Deprecated Code introduced by
The property NovaFlexibleContent\Layo...scription::$tagInfoFrom has been deprecated: Please use "fieldUsedForDescription" ( Ignorable by Annotation )

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

39
        return $this->fieldUsedForDescription ?? /** @scrutinizer ignore-deprecated */ $this->tagInfoFrom;

This property has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the property will be removed from the class and what other property to use instead.

Loading history...
40
    }
41
}
42