models/classes/runner/QtiRunnerService.php
public function emptyResponse(RunnerServiceContext $context, $responses)
    {
        if ($context instanceof QtiRunnerServiceContext) {
            $similar = 0;

            /** @var ResponseVariable $responseVariable */
            foreach ($responses as $responseVariable) {
                $value = $responseVariable->getValue();
                $default = $responseVariable->getDefaultValue();

                // Similar to default ?
                if (TestRunnerUtils::isQtiValueNull($value) === true) {
                    if (TestRunnerUtils::isQtiValueNull($default) === true) {
                        $similar++;
                    }
                } elseif ($value->equals($default) === true) {
                    $similar++;
                }
            }

            $respCount = count($responses);
            return $respCount > 0 && $similar == $respCount;
        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'storeItemResponse',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }
    }
public function emptyResponse(RunnerServiceContext $context, $responses)
    {
        if ($context instanceof QtiRunnerServiceContext) {
            $similar = 0;

            /** @var ResponseVariable $responseVariable */
            foreach ($responses as $responseVariable) {
                $value = $responseVariable->getValue();
                $default = $responseVariable->getDefaultValue();

                // Similar to default ?
                if (TestRunnerUtils::isQtiValueNull($value) === true) {
                    if (TestRunnerUtils::isQtiValueNull($default) === true) {
                        $similar++;
                    }
                } elseif ($value->equals($default) === true) {
                    $similar++;
                }
            }

            $respCount = count($responses);
            return $respCount > 0 && $similar == $respCount;
        } else {
            throw new \common_exception_InvalidArgumentType(
                'QtiRunnerService',
                'storeItemResponse',
                0,
                'oat\taoQtiTest\models\runner\QtiRunnerServiceContext',
                $context
            );
        }
    }
public function emptyResponse ( RunnerServiceContext $ context , $ responses ) { if ( $ context instanceof QtiRunnerServiceContext ) { $ similar = 0 ; /** @var ResponseVariable $responseVariable */ foreach ( $ responses as $ responseVariable ) { $ value = $ responseVariable -> getValue ( ) ; $ default = $ responseVariable -> getDefaultValue ( ) ; // Similar to default ? if ( TestRunnerUtils :: isQtiValueNull ( $ value ) === true ) { if ( TestRunnerUtils :: isQtiValueNull ( $ default ) === true ) { $ similar ++ ; } } elseif ( $ value -> equals ( $ default ) === true ) { $ similar ++ ; } } $ respCount = count ( $ responses ) ; return $ respCount > 0 && $ similar == $ respCount ; } else { throw new \ common_exception_InvalidArgumentType ( 'QtiRunnerService' , 'storeItemResponse' , 0 , 'oat\taoQtiTest\models\runner\QtiRunnerServiceContext' , $ context ) ; } }
Checks if the provided responses are empty
@param RunnerServiceContext $context
@param $responses
@return mixed
@throws \common_Exception
Checks if the provided responses are empty