Completed
Push — master ( 718f9d...90802e )
by Alexandr
02:52
created

Processor::getVariableReferenceArgumentValue()   C

Complexity

Conditions 10
Paths 6

Size

Total Lines 24
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 10.0296

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 24
ccs 14
cts 15
cp 0.9333
rs 5.2164
cc 10
eloc 15
nc 6
nop 3
crap 10.0296

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
/**
3
 * Date: 03.11.16
4
 *
5
 * @author Portey Vasil <[email protected]>
6
 */
7
8
namespace Youshido\GraphQL\Execution;
9
10
11
use Youshido\GraphQL\Exception\ResolveException;
12
use Youshido\GraphQL\Execution\Container\Container;
13
use Youshido\GraphQL\Execution\Context\ExecutionContext;
14
use Youshido\GraphQL\Execution\Visitor\MaxComplexityQueryVisitor;
15
use Youshido\GraphQL\Field\Field;
16
use Youshido\GraphQL\Field\FieldInterface;
17
use Youshido\GraphQL\Field\InputField;
18
use Youshido\GraphQL\Parser\Ast\ArgumentValue\InputList as AstInputList;
19
use Youshido\GraphQL\Parser\Ast\ArgumentValue\InputObject as AstInputObject;
20
use Youshido\GraphQL\Parser\Ast\ArgumentValue\Literal as AstLiteral;
21
use Youshido\GraphQL\Parser\Ast\ArgumentValue\VariableReference;
22
use Youshido\GraphQL\Parser\Ast\Field as AstField;
23
use Youshido\GraphQL\Parser\Ast\FragmentReference;
24
use Youshido\GraphQL\Parser\Ast\Interfaces\FieldInterface as AstFieldInterface;
25
use Youshido\GraphQL\Parser\Ast\Mutation as AstMutation;
26
use Youshido\GraphQL\Parser\Ast\Query as AstQuery;
27
use Youshido\GraphQL\Parser\Ast\Query;
28
use Youshido\GraphQL\Parser\Ast\TypedFragmentReference;
29
use Youshido\GraphQL\Parser\Parser;
30
use Youshido\GraphQL\Schema\AbstractSchema;
31
use Youshido\GraphQL\Type\AbstractType;
32
use Youshido\GraphQL\Type\InputObject\AbstractInputObjectType;
33
use Youshido\GraphQL\Type\InterfaceType\AbstractInterfaceType;
34
use Youshido\GraphQL\Type\ListType\AbstractListType;
35
use Youshido\GraphQL\Type\Object\AbstractObjectType;
36
use Youshido\GraphQL\Type\Scalar\AbstractScalarType;
37
use Youshido\GraphQL\Type\TypeMap;
38
use Youshido\GraphQL\Type\Union\AbstractUnionType;
39
use Youshido\GraphQL\Validator\RequestValidator\RequestValidator;
40
use Youshido\GraphQL\Validator\ResolveValidator\ResolveValidator;
41
use Youshido\GraphQL\Validator\ResolveValidator\ResolveValidatorInterface;
42
43
class Processor
44
{
45
46
    const TYPE_NAME_QUERY = '__typename';
47
48
    /** @var ExecutionContext */
49
    protected $executionContext;
50
51
    /** @var ResolveValidatorInterface */
52
    protected $resolveValidator;
53
54
    /** @var  array */
55
    protected $data;
56
57
    /** @var int */
58
    protected $maxComplexity;
59
60 56
    public function __construct(AbstractSchema $schema)
61
    {
62 56
        if (empty($this->executionContext)) {
63 56
            $this->executionContext = new ExecutionContext($schema);
64 56
            $this->executionContext->setContainer(new Container());
65 56
        }
66
67 56
        $this->resolveValidator = new ResolveValidator($this->executionContext);
0 ignored issues
show
Unused Code introduced by
The call to ResolveValidator::__construct() has too many arguments starting with $this->executionContext.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
68 56
    }
69
70 54
    public function processPayload($payload, $variables = [], $reducers = [])
71
    {
72 54
        $this->data = [];
73
74
        try {
75 54
            $this->parseAndCreateRequest($payload, $variables);
76
77 53
            if ($this->maxComplexity) {
78 1
                $reducers[] = new MaxComplexityQueryVisitor($this->maxComplexity);
79 1
            }
80
81 53
            if ($reducers) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $reducers of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
82 2
                $reducer = new Reducer();
83 2
                $reducer->reduceQuery($this->executionContext, $reducers);
84 2
            }
85
86 53
            foreach ($this->executionContext->getRequest()->getAllOperations() as $query) {
87 53
                if ($operationResult = $this->resolveQuery($query)) {
88 53
                    $this->data = array_merge($this->data, $operationResult);
89 53
                };
90 53
            }
91 54
        } catch (\Exception $e) {
92 5
            $this->executionContext->addError($e);
93
        }
94
95 54
        return $this;
96
    }
97
98 53
    protected function resolveQuery(AstQuery $query)
99
    {
100 53
        $schema = $this->executionContext->getSchema();
101 53
        $type   = $query instanceof AstMutation ? $schema->getMutationType() : $schema->getQueryType();
102 53
        $field  = new Field([
103 53
            'name' => $query instanceof AstMutation ? 'mutation' : 'query',
104
            'type' => $type
105 53
        ]);
106
107 53
        if (self::TYPE_NAME_QUERY == $query->getName()) {
108 1
            return [$this->getAlias($query) => $type->getName()];
109
        }
110
111 53
        $this->resolveValidator->assetTypeHasField($type, $query);
112 53
        $value = $this->resolveField($field, $query);
113
114 53
        return [$this->getAlias($query) => $value];
115
    }
116
117 53
    protected function resolveField(FieldInterface $field, AstFieldInterface $ast, $parentValue = null, $fromObject = false)
118
    {
119
        try {
120
            /** @var AbstractObjectType $type */
121 53
            $type        = $field->getType();
122 53
            $nonNullType = $type->getNullableType();
123
124 53
            if (self::TYPE_NAME_QUERY == $ast->getName()) {
125 2
                return $nonNullType->getName();
126
            }
127
128 53
            $this->resolveValidator->assetTypeHasField($nonNullType, $ast);
129
130 53
            $targetField = $nonNullType->getField($ast->getName());
131
132 53
            $this->prepareAstArguments($targetField, $ast, $this->executionContext->getRequest());
133 52
            $this->resolveValidator->assertValidArguments($targetField, $ast, $this->executionContext->getRequest());
134
135 48
            switch ($kind = $targetField->getType()->getNullableType()->getKind()) {
136 48
                case TypeMap::KIND_ENUM:
137 48
                case TypeMap::KIND_SCALAR:
138 42
                    if ($ast instanceof AstQuery && $ast->hasFields()) {
139 2
                        throw new ResolveException(sprintf('You can\'t specify fields for scalar type "%s"', $targetField->getType()->getNullableType()->getName()), $ast->getLocation());
140
                    }
141
142 42
                    return $this->resolveScalar($targetField, $ast, $parentValue);
143
144 32 View Code Duplication
                case TypeMap::KIND_OBJECT:
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
145
                    /** @var $type AbstractObjectType */
146 24
                    if (!$ast instanceof AstQuery) {
147 1
                        throw new ResolveException(sprintf('You have to specify fields for "%s"', $ast->getName()), $ast->getLocation());
148
                    }
149
150 24
                    return $this->resolveObject($targetField, $ast, $parentValue);
151
152 19
                case TypeMap::KIND_LIST:
153 16
                    return $this->resolveList($targetField, $ast, $parentValue);
154
155 6
                case TypeMap::KIND_UNION:
156 6 View Code Duplication
                case TypeMap::KIND_INTERFACE:
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
157 6
                    if (!$ast instanceof AstQuery) {
158
                        throw new ResolveException(sprintf('You have to specify fields for "%s"', $ast->getName()), $ast->getLocation());
159
                    }
160
161 6
                    return $this->resolveComposite($targetField, $ast, $parentValue);
162
163
                default:
164
                    throw new ResolveException(sprintf('Resolving type with kind "%s" not supported', $kind));
165
            }
166 16
        } catch (\Exception $e) {
167 16
            $this->executionContext->addError($e);
168
169 16
            if ($fromObject) {
170 4
                throw $e;
171
            }
172
173 14
            return null;
174
        }
175
    }
176
177 53
    private function prepareAstArguments(FieldInterface $field, AstFieldInterface $query, Request $request)
178
    {
179 53
        foreach ($query->getArguments() as $astArgument) {
180 30
            if ($field->hasArgument($astArgument->getName())) {
181 30
                $argumentType = $field->getArgument($astArgument->getName())->getType()->getNullableType();
182
183 30
                $astArgument->setValue($this->prepareArgumentValue($astArgument->getValue(), $argumentType, $request));
184 29
            }
185 52
        }
186 52
    }
187
188 30
    private function prepareArgumentValue($argumentValue, AbstractType $argumentType, Request $request)
189
    {
190 30
        switch ($argumentType->getKind()) {
191 30
            case TypeMap::KIND_LIST:
192
                /** @var $argumentType AbstractListType */
193 6
                $result = [];
194 6
                if ($argumentValue instanceof AstInputList || is_array($argumentValue)) {
195 5
                    $list = is_array($argumentValue) ? $argumentValue : $argumentValue->getValue();
196 5
                    foreach ($list as $item) {
197 5
                        $result[] = $this->prepareArgumentValue($item, $argumentType->getItemType()->getNullableType(), $request);
198 5
                    }
199 6
                } else if ($argumentValue instanceof VariableReference) {
200 1
                    return $this->getVariableReferenceArgumentValue($argumentValue, $argumentType, $request);
201
                }
202
203 5
                return $result;
204
205 29
            case TypeMap::KIND_INPUT_OBJECT:
206
                /** @var $argumentType AbstractInputObjectType */
207 5
                $result = [];
208 5
                if ($argumentValue instanceof AstInputObject) {
209 4
                    foreach ($argumentType->getFields() as $field) {
210
                        /** @var $field Field */
211 4
                        if ($field->getConfig()->has('default')) {
212 1
                            $result[$field->getName()] = $field->getType()->getNullableType()->parseInputValue($field->getConfig()->get('default'));
213 1
                        }
214 4
                    }
215 4
                    foreach ($argumentValue->getValue() as $key => $item) {
216 4
                        if ($argumentType->hasField($key)) {
217 4
                            $result[$key] = $this->prepareArgumentValue($item, $argumentType->getField($key)->getType()->getNullableType(), $request);
218 4
                        } else {
219
                            $result[$key] = $item;
220
                        }
221 4
                    }
222 5
                } else if ($argumentValue instanceof VariableReference) {
223
                    return $this->getVariableReferenceArgumentValue($argumentValue, $argumentType, $request);
224 2
                } else if (is_array($argumentValue)) {
225 1
                    return $argumentValue;
226
                }
227
228 5
                return $result;
229
230 28
            case TypeMap::KIND_SCALAR:
231 28
            case TypeMap::KIND_ENUM:
232
                /** @var $argumentValue AstLiteral|VariableReference */
233 28
                if ($argumentValue instanceof VariableReference) {
234 5
                    return $this->getVariableReferenceArgumentValue($argumentValue, $argumentType, $request);
235 24
                } else if ($argumentValue instanceof AstLiteral) {
236 17
                    return $argumentValue->getValue();
237
                } else {
238 8
                    return $argumentValue;
239
                }
240
        }
241
242
        throw new ResolveException('Argument type not supported');
243
    }
244
245 6
    private function getVariableReferenceArgumentValue(VariableReference $variableReference, AbstractType $argumentType, Request $request)
246
    {
247 6
        $variable = $variableReference->getVariable();
248 6
        if ($argumentType->getKind() === TypeMap::KIND_LIST) {
249
            if (
250 1
                !$variable->isArray() ||
251 1
                ($variable->getTypeName() !== $argumentType->getNamedType()->getNullableType()->getName()) ||
252 1
                ($argumentType->getNamedType()->getKind() === TypeMap::KIND_NON_NULL && $variable->isArrayElementNullable())
253 1
            ) {
254 1
                throw new ResolveException(sprintf('Invalid variable "%s" type, allowed type is "%s"', $variable->getName(), $argumentType->getNamedType()->getNullableType()->getName()), $variable->getLocation());
255
            }
256 1
        } else {
257 5
            if ($variable->getTypeName() !== $argumentType->getName()) {
258 1
                throw new ResolveException(sprintf('Invalid variable "%s" type, allowed type is "%s"', $variable->getName(), $argumentType->getName()), $variable->getLocation());
259
            }
260
        }
261
262 5
        $requestValue = $request->getVariable($variable->getName());
263 5
        if ((null === $requestValue && $variable->isNullable()) && !$request->hasVariable($variable->getName())) {
264
            throw new ResolveException(sprintf('Variable "%s" does not exist in request', $variable->getName()), $variable->getLocation());
265
        }
266
267 5
        return $requestValue;
268
    }
269
270 29
    protected function resolveObject(FieldInterface $field, AstFieldInterface $ast, $parentValue, $fromUnion = false)
271
    {
272 29
        $resolvedValue = $parentValue;
273 29
        if (!$fromUnion) {
274 24
            $resolvedValue = $this->doResolve($field, $ast, $parentValue);
275 24
        }
276
277 29
        $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue);
278
279 29
        if (null === $resolvedValue) {
280 5
            return null;
281
        }
282
        /** @var AbstractObjectType $type */
283 28
        $type = $field->getType()->getNullableType();
284
285
        try {
286 28
            return $this->collectResult($field, $type, $ast, $resolvedValue);
287 4
        } catch (\Exception $e) {
288 4
            return null;
289
        }
290
    }
291
292 28
    private function collectResult(FieldInterface $field, AbstractObjectType $type, $ast, $resolvedValue)
293
    {
294
        /** @var AstQuery $ast */
295 28
        $result = [];
296
297 28
        foreach ($ast->getFields() as $astField) {
298 28
            switch (true) {
299 28
                case $astField instanceof TypedFragmentReference:
300 2
                    $astName  = $astField->getTypeName();
301 2
                    $typeName = $type->getName();
302
303 2 View Code Duplication
                    if ($typeName !== $astName) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
304 2
                        foreach ($type->getInterfaces() as $interface) {
305 1
                            if ($interface->getName() === $astName) {
306
                                $result = array_merge($result, $this->collectResult($field, $type, $astField, $resolvedValue));
307
308
                                break;
309
                            }
310 2
                        }
311
312 2
                        continue;
313
                    }
314
315 2
                    $result = array_merge($result, $this->collectResult($field, $type, $astField, $resolvedValue));
316
317 2
                    break;
318
319 28
                case $astField instanceof FragmentReference:
320 4
                    $astFragment      = $this->executionContext->getRequest()->getFragment($astField->getName());
321 4
                    $astFragmentModel = $astFragment->getModel();
322 4
                    $typeName         = $type->getName();
323
324 4 View Code Duplication
                    if ($typeName !== $astFragmentModel) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
325 1
                        foreach ($type->getInterfaces() as $interface) {
326 1
                            if ($interface->getName() === $astFragmentModel) {
327 1
                                $result = array_merge($result, $this->collectResult($field, $type, $astFragment, $resolvedValue));
328
329 1
                                break;
330
                            }
331
332 1
                        }
333
334 1
                        continue;
335
                    }
336
337 4
                    $result = array_merge($result, $this->collectResult($field, $type, $astFragment, $resolvedValue));
338
339 4
                    break;
340
341 28
                default:
342 28
                    $result[$this->getAlias($astField)] = $this->resolveField($field, $astField, $resolvedValue, true);
343 28
            }
344 28
        }
345
346 28
        return $result;
347
    }
348
349 42
    protected function resolveScalar(FieldInterface $field, AstFieldInterface $ast, $parentValue)
350
    {
351 42
        $resolvedValue = $this->doResolve($field, $ast, $parentValue);
352
353 42
        $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue);
354
355
        /** @var AbstractScalarType $type */
356 41
        $type = $field->getType()->getNullableType();
357
358 41
        return $type->serialize($resolvedValue);
359
    }
360
361 16
    protected function resolveList(FieldInterface $field, AstFieldInterface $ast, $parentValue)
362
    {
363
        /** @var AstQuery $ast */
364 16
        $resolvedValue = $this->doResolve($field, $ast, $parentValue);
365
366 16
        $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue);
367
368 14
        if (null === $resolvedValue) {
369 5
            return null;
370
        }
371
372
        /** @var AbstractListType $type */
373 13
        $type     = $field->getType()->getNullableType();
374 13
        $itemType = $type->getNamedType();
375
376 13
        $fakeAst = clone $ast;
377 13
        if ($fakeAst instanceof AstQuery) {
378 13
            $fakeAst->setArguments([]);
379 13
        }
380
381 13
        $fakeField = new Field([
382 13
            'name' => $field->getName(),
383 13
            'type' => $itemType,
384 13
        ]);
385
386 13
        $result = [];
387 13
        foreach ($resolvedValue as $resolvedValueItem) {
388
            try {
389 12
                $fakeField->getConfig()->set('resolve', function () use ($resolvedValueItem) {
390 12
                    return $resolvedValueItem;
391 12
                });
392
393 12
                switch ($itemType->getNullableType()->getKind()) {
394 12
                    case TypeMap::KIND_ENUM:
395 12
                    case TypeMap::KIND_SCALAR:
396 3
                        $value = $this->resolveScalar($fakeField, $fakeAst, $resolvedValueItem);
397
398 2
                        break;
399
400
401 10
                    case TypeMap::KIND_OBJECT:
402 8
                        $value = $this->resolveObject($fakeField, $fakeAst, $resolvedValueItem);
403
404 8
                        break;
405
406 3
                    case TypeMap::KIND_UNION:
407 3
                    case TypeMap::KIND_INTERFACE:
408 3
                        $value = $this->resolveComposite($fakeField, $fakeAst, $resolvedValueItem);
409
410 3
                        break;
411
412
                    default:
413
                        $value = null;
414 11
                }
415 12
            } catch (\Exception $e) {
416 1
                $this->executionContext->addError($e);
417
418 1
                $value = null;
419
            }
420
421 12
            $result[] = $value;
422 13
        }
423
424 13
        return $result;
425
    }
426
427 7
    protected function resolveComposite(FieldInterface $field, AstFieldInterface $ast, $parentValue)
428
    {
429
        /** @var AstQuery $ast */
430 7
        $resolvedValue = $this->doResolve($field, $ast, $parentValue);
431
432 7
        $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue);
433
434
        /** @var AbstractUnionType $type */
435 7
        $type         = $field->getType()->getNullableType();
436 7
        $resolvedType = $type->resolveType($resolvedValue);
437
438 7
        if (!$resolvedType) {
439
            throw new ResolveException('Resolving function must return type');
440
        }
441
442 7
        if ($type instanceof AbstractInterfaceType) {
443 6
            $this->resolveValidator->assertTypeImplementsInterface($resolvedType, $type);
444 6
        } else {
445 1
            $this->resolveValidator->assertTypeInUnionTypes($resolvedType, $type);
446
        }
447
448 7
        $fakeField = new Field([
449 7
            'name' => $field->getName(),
450 7
            'type' => $resolvedType,
451 7
        ]);
452
453 7
        return $this->resolveObject($fakeField, $ast, $resolvedValue, true);
454
    }
455
456 54
    protected function parseAndCreateRequest($payload, $variables = [])
457
    {
458 54
        if (empty($payload)) {
459 1
            throw new \InvalidArgumentException('Must provide an operation.');
460
        }
461
462 54
        $parser  = new Parser();
463 54
        $request = new Request($parser->parse($payload), $variables);
464
465 54
        (new RequestValidator())->validate($request);
466
467 53
        $this->executionContext->setRequest($request);
468 53
    }
469
470 48
    protected function doResolve(FieldInterface $field, AstFieldInterface $ast, $parentValue = null)
471
    {
472
        /** @var AstQuery|AstField $ast */
473 48
        $arguments = $this->parseArgumentsValues($field, $ast);
474 48
        $astFields = $ast instanceof AstQuery ? $ast->getFields() : [];
475
476 48
        return $field->resolve($parentValue, $arguments, $this->createResolveInfo($field, $astFields));
477
    }
478
479 48
    protected function parseArgumentsValues(FieldInterface $field, AstFieldInterface $ast)
480
    {
481 48
        $values   = [];
482 48
        $defaults = [];
483
484 48
        foreach ($field->getArguments() as $argument) {
485
            /** @var $argument InputField */
486 34
            if ($argument->getConfig()->has('default')) {
487 6
                $defaults[$argument->getName()] = $argument->getConfig()->getDefaultValue();
488 6
            }
489 48
        }
490
491 48
        foreach ($ast->getArguments() as $astArgument) {
492 27
            $argument     = $field->getArgument($astArgument->getName());
493 27
            $argumentType = $argument->getType()->getNullableType();
494
495 27
            $values[$argument->getName()] = $argumentType->parseValue($astArgument->getValue());
496
497 27
            if (isset($defaults[$argument->getName()])) {
498 3
                unset($defaults[$argument->getName()]);
499 3
            }
500 48
        }
501
502 48
        return array_merge($values, $defaults);
503
    }
504
505 53
    private function getAlias(AstFieldInterface $ast)
506
    {
507 53
        return $ast->getAlias() ?: $ast->getName();
508
    }
509
510 48
    protected function createResolveInfo(FieldInterface $field, array $astFields)
511
    {
512 48
        return new ResolveInfo($field, $astFields, $this->executionContext);
513
    }
514
515
516
    /**
517
     * You can access ExecutionContext to check errors and inject dependencies
518
     *
519
     * @return ExecutionContext
520
     */
521 11
    public function getExecutionContext()
522
    {
523 11
        return $this->executionContext;
524
    }
525
526 54
    public function getResponseData()
527
    {
528 54
        $result = [];
529
530 54
        if (!empty($this->data)) {
531 53
            $result['data'] = $this->data;
532 53
        }
533
534 54
        if ($this->executionContext->hasErrors()) {
535 18
            $result['errors'] = $this->executionContext->getErrorsArray();
536 18
        }
537
538 54
        return $result;
539
    }
540
541
    /**
542
     * @return int
543
     */
544
    public function getMaxComplexity()
545
    {
546
        return $this->maxComplexity;
547
    }
548
549
    /**
550
     * @param int $maxComplexity
551
     */
552 1
    public function setMaxComplexity($maxComplexity)
553
    {
554 1
        $this->maxComplexity = $maxComplexity;
555 1
    }
556
557
}
558