Conditions | 3 |
Paths | 3 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
36 | 2 | public function getText() |
|
37 | { |
||
38 | 2 | $text = ''; |
|
39 | 2 | foreach ($this->xmlField->Data->Object as $object) { |
|
40 | 2 | if ($object->SrcField) { // @codingStandardsIgnoreLine |
|
41 | // Field is a merge field, fetch text from source field |
||
42 | 2 | $sourceFieldName = (string) $object->SrcField->attributes()->SrcFieldName; // @codingStandardsIgnoreLine |
|
43 | 2 | $sourceField = $this->fieldParserRegistry->getParser($sourceFieldName); |
|
44 | 2 | $fieldText = $sourceField->getText(); |
|
45 | } else { |
||
46 | 2 | $fieldText = (string) $object->Default; // @codingStandardsIgnoreLine |
|
47 | } |
||
48 | |||
49 | 2 | $text .= $fieldText; |
|
50 | } |
||
51 | |||
52 | 2 | return $text; |
|
53 | } |
||
54 | } |
||
55 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: