Test Failed
Push — main ( 5af89f...c76fcf )
by Bingo
05:51
created

initializeValue()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 13
rs 9.9666
cc 3
nc 3
nop 2
1
<?php
2
3
namespace Jabe\Engine\Impl;
4
5
use Jabe\Engine\Impl\Context\Context;
6
use Jabe\Engine\Impl\Variable\Serializer\VariableSerializersInterface;
7
8
class CompositeQueryVariableValueCondition extends AbstractQueryVariableValueCondition
9
{
10
    protected $aggregatedValues = [];
11
12
    public function __construct(QueryVariableValue $variableValue)
13
    {
14
        parent::__construct($variableValue);
15
    }
16
17
    public function initializeValue(VariableSerializersInterface $serializers, string $dbType): void
18
    {
19
        $typedValue = $this->wrappedQueryValue->getTypedValue();
20
21
        $resolver = Context::getProcessEngineConfiguration()->getValueTypeResolver();
22
        $concreteTypes = $resolver->getSubTypes($typedValue->getType());
0 ignored issues
show
Bug introduced by
It seems like $typedValue->getType() can also be of type null; however, parameter $type of Jabe\Engine\Variable\Typ...nterface::getSubTypes() does only seem to accept Jabe\Engine\Variable\Type\ValueTypeInterface, 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

22
        $concreteTypes = $resolver->getSubTypes(/** @scrutinizer ignore-type */ $typedValue->getType());
Loading history...
23
24
        foreach ($concreteTypes as $type) {
25
            if ($type->canConvertFromTypedValue($typedValue)) {
26
                $convertedValue = $type->convertFromTypedValue($typedValue);
27
                $aggregatedValue = new SingleQueryVariableValueCondition($this->wrappedQueryValue);
0 ignored issues
show
Bug introduced by
The type Jabe\Engine\Impl\SingleQueryVariableValueCondition was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
28
                $aggregatedValue->initializeValue($serializers, $convertedValue, $dbType);
29
                $this->aggregatedValues[] = $aggregatedValue;
30
            }
31
        }
32
    }
33
34
    public function getDisjunctiveConditions(): array
35
    {
36
        return $this->aggregatedValues;
37
    }
38
}
39