InFieldset   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 4
eloc 7
c 1
b 1
f 0
dl 0
loc 25
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A initInFieldset() 0 8 4
1
<?php
2
3
namespace Riclep\StoryblokForms\Traits;
4
5
use Riclep\StoryblokForms\Blocks\LsfConditionalSelect;
6
use Riclep\StoryblokForms\Blocks\LsfFieldset;
7
use Riclep\StoryblokForms\Blocks\LsfRepeatingFieldset;
8
9
trait InFieldset
10
{
11
	/**
12
	 * This field is in a fieldset
13
	 *
14
	 * @var bool
15
	 */
16
	protected $inFieldSet = false;
17
18
19
	/**
20
	 * This field is in a repeating fieldset
21
	 *
22
	 * @var bool
23
	 */
24
	protected $isRepeating = false;
25
26
	protected function initInFieldset(): void
27
	{
28
		if ($this->parent() instanceof LsfFieldset || $this->parent() instanceof LsfConditionalSelect) {
0 ignored issues
show
Bug introduced by
It seems like parent() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

28
		if ($this->/** @scrutinizer ignore-call */ parent() instanceof LsfFieldset || $this->parent() instanceof LsfConditionalSelect) {
Loading history...
29
			$this->inFieldSet = true;
30
		}
31
32
		if ($this->parent() instanceof LsfRepeatingFieldset) {
33
			$this->isRepeating = true;
34
		}
35
	}
36
37
}