Code Duplication    Length = 13-14 lines in 3 locations

src/POData/UriProcessor/QueryProcessor/FunctionDescription.php 3 locations

@@ 576-589 (lines=14) @@
573
    ) {
574
        //for null operands only equality operators are allowed
575
        $null = new Null1();
576
        if ($leftArgument->typeIs($null) || $rightArgument->typeIs($null)) {
577
            if ((strcmp($expressionToken->Text, ODataConstants::KEYWORD_EQUAL) != 0)
578
                && (strcmp($expressionToken->Text, ODataConstants::KEYWORD_NOT_EQUAL) != 0)
579
            ) {
580
                throw ODataException::createSyntaxError(
581
                    Messages::expressionParserOperatorNotSupportNull(
582
                        $expressionToken->Text,
583
                        $expressionToken->Position
584
                    )
585
                );
586
            }
587
588
            return;
589
        }
590
591
        //for guid operands only equality operators are allowed
592
        $guid = new Guid();
@@ 593-605 (lines=13) @@
590
591
        //for guid operands only equality operators are allowed
592
        $guid = new Guid();
593
        if ($leftArgument->typeIs($guid) && $rightArgument->typeIs($guid)) {
594
            if ((strcmp($expressionToken->Text, ODataConstants::KEYWORD_EQUAL) != 0)
595
                && (strcmp($expressionToken->Text, ODataConstants::KEYWORD_NOT_EQUAL) != 0)
596
            ) {
597
                throw ODataException::createSyntaxError(
598
                    Messages::expressionParserOperatorNotSupportGuid(
599
                        $expressionToken->Text,
600
                        $expressionToken->Position
601
                    )
602
                );
603
            }
604
605
            return;
606
        }
607
608
        //for binary operands only equality operators are allowed
@@ 610-622 (lines=13) @@
607
608
        //for binary operands only equality operators are allowed
609
        $binary = new Binary();
610
        if ($leftArgument->typeIs($binary) && $rightArgument->typeIs($binary)) {
611
            if ((strcmp($expressionToken->Text, ODataConstants::KEYWORD_EQUAL) != 0)
612
                && (strcmp($expressionToken->Text, ODataConstants::KEYWORD_NOT_EQUAL) != 0)
613
            ) {
614
                throw ODataException::createSyntaxError(
615
                    Messages::expressionParserOperatorNotSupportBinary(
616
                        $expressionToken->Text,
617
                        $expressionToken->Position
618
                    )
619
                );
620
            }
621
622
            return;
623
        }
624
625
        //TODO: eq and ne is valid for 'resource reference'