src/Server/Helper.php
private function resolveHttpStatus($result)
    {
        if (is_array($result) && isset($result[0])) {
            Utils::each(
                $result,
                static function ($executionResult, $index) {
                    if (! $executionResult instanceof ExecutionResult) {
                        throw new InvariantViolation(sprintf(
                            'Expecting every entry of batched query result to be instance of %s but entry at position %d is %s',
                            ExecutionResult::class,
                            $index,
                            Utils::printSafe($executionResult)
                        ));
                    }
                }
            );
            $httpStatus = 200;
        } else {
            if (! $result instanceof ExecutionResult) {
                throw new InvariantViolation(sprintf(
                    'Expecting query result to be instance of %s but got %s',
                    ExecutionResult::class,
                    Utils::printSafe($result)
                ));
            }
            if ($result->data === null && ! empty($result->errors)) {
                $httpStatus = 400;
            } else {
                $httpStatus = 200;
            }
        }

        return $httpStatus;
    }
private function resolveHttpStatus($result)
    {
        if (is_array($result) && isset($result[0])) {
            Utils::each(
                $result,
                static function ($executionResult, $index) {
                    if (! $executionResult instanceof ExecutionResult) {
                        throw new InvariantViolation(sprintf(
                            'Expecting every entry of batched query result to be instance of %s but entry at position %d is %s',
                            ExecutionResult::class,
                            $index,
                            Utils::printSafe($executionResult)
                        ));
                    }
                }
            );
            $httpStatus = 200;
        } else {
            if (! $result instanceof ExecutionResult) {
                throw new InvariantViolation(sprintf(
                    'Expecting query result to be instance of %s but got %s',
                    ExecutionResult::class,
                    Utils::printSafe($result)
                ));
            }
            if ($result->data === null && ! empty($result->errors)) {
                $httpStatus = 400;
            } else {
                $httpStatus = 200;
            }
        }

        return $httpStatus;
    }
private function resolveHttpStatus ( $ result ) { if ( is_array ( $ result ) && isset ( $ result [ 0 ] ) ) { Utils :: each ( $ result , static function ( $ executionResult , $ index ) { if ( ! $ executionResult instanceof ExecutionResult ) { throw new InvariantViolation ( sprintf ( 'Expecting every entry of batched query result to be instance of %s but entry at position %d is %s' , ExecutionResult :: class , $ index , Utils :: printSafe ( $ executionResult ) ) ) ; } } ) ; $ httpStatus = 200 ; } else { if ( ! $ result instanceof ExecutionResult ) { throw new InvariantViolation ( sprintf ( 'Expecting query result to be instance of %s but got %s' , ExecutionResult :: class , Utils :: printSafe ( $ result ) ) ) ; } if ( $ result -> data === null && ! empty ( $ result -> errors ) ) { $ httpStatus = 400 ; } else { $ httpStatus = 200 ; } } return $ httpStatus ; }
@param ExecutionResult|mixed[] $result

@return int
@param ExecutionResult|mixed [] $result