Code Duplication    Length = 17-17 lines in 2 locations

Classes/Persistence/Query.php 2 locations

@@ 386-402 (lines=17) @@
383
     * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\AndInterface
384
     * @api
385
     */
386
    public function logicalAnd($constraint1)
387
    {
388
        if (is_array($constraint1)) {
389
            $resultingConstraint = array_shift($constraint1);
390
            $constraints = $constraint1;
391
        } else {
392
            $constraints = func_get_args();
393
            $resultingConstraint = array_shift($constraints);
394
        }
395
        if ($resultingConstraint === null) {
396
            throw new InvalidNumberOfConstraintsException('There must be at least one constraint or a non-empty array of constraints given.', 1401289500);
397
        }
398
        foreach ($constraints as $constraint) {
399
            $resultingConstraint = $this->qomFactory->_and($resultingConstraint, $constraint);
400
        }
401
        return $resultingConstraint;
402
    }
403
404
    /**
405
     * Performs a logical disjunction of the two given constraints
@@ 412-428 (lines=17) @@
409
     * @return \TYPO3\CMS\Extbase\Persistence\Generic\Qom\OrInterface
410
     * @api
411
     */
412
    public function logicalOr($constraint1)
413
    {
414
        if (is_array($constraint1)) {
415
            $resultingConstraint = array_shift($constraint1);
416
            $constraints = $constraint1;
417
        } else {
418
            $constraints = func_get_args();
419
            $resultingConstraint = array_shift($constraints);
420
        }
421
        if ($resultingConstraint === null) {
422
            throw new InvalidNumberOfConstraintsException('There must be at least one constraint or a non-empty array of constraints given.', 1401289501);
423
        }
424
        foreach ($constraints as $constraint) {
425
            $resultingConstraint = $this->qomFactory->_or($resultingConstraint, $constraint);
426
        }
427
        return $resultingConstraint;
428
    }
429
430
    /**
431
     * Performs a logical negation of the given constraint