public function isExpired(DeliveryExecution $deliveryExecution)
    {
        $result = false;
        $executionState = $deliveryExecution->getState()->getUri();
        $lastTestTakersEvent = $this->getLastTestTakersEvent($deliveryExecution);

        if (in_array($executionState, [
                DeliveryExecutionState::STATE_AWAITING,
                DeliveryExecutionState::STATE_AUTHORIZED,
            ]) &&
            $lastTestTakersEvent)
        {
            /** @var \oat\taoProctoring\model\implementation\DeliveryExecutionStateService $deliveryExecutionStateService */
            $deliveryExecutionStateService = $this->getServiceLocator()->get(DeliveryExecutionStateService::SERVICE_ID);
            $delay = $deliveryExecutionStateService->getOption(DeliveryExecutionStateService::OPTION_CANCELLATION_DELAY);
            $lastTestEventTime = (new DateTimeImmutable())->setTimestamp($lastTestTakersEvent['created_at']);
            $result = ($lastTestEventTime->add(new DateInterval($delay)) < (new DateTimeImmutable()));
        }

        return $result;
    }
public function isExpired(DeliveryExecution $deliveryExecution)
    {
        $result = false;
        $executionState = $deliveryExecution->getState()->getUri();
        $lastTestTakersEvent = $this->getLastTestTakersEvent($deliveryExecution);

        if (in_array($executionState, [
                DeliveryExecutionState::STATE_AWAITING,
                DeliveryExecutionState::STATE_AUTHORIZED,
            ]) &&
            $lastTestTakersEvent)
        {
            /** @var \oat\taoProctoring\model\implementation\DeliveryExecutionStateService $deliveryExecutionStateService */
            $deliveryExecutionStateService = $this->getServiceLocator()->get(DeliveryExecutionStateService::SERVICE_ID);
            $delay = $deliveryExecutionStateService->getOption(DeliveryExecutionStateService::OPTION_CANCELLATION_DELAY);
            $lastTestEventTime = (new DateTimeImmutable())->setTimestamp($lastTestTakersEvent['created_at']);
            $result = ($lastTestEventTime->add(new DateInterval($delay)) < (new DateTimeImmutable()));
        }

        return $result;
    }
public function isExpired ( DeliveryExecution $ deliveryExecution ) { $ result = false ; $ executionState = $ deliveryExecution -> getState ( ) -> getUri ( ) ; $ lastTestTakersEvent = $ this -> getLastTestTakersEvent ( $ deliveryExecution ) ; if ( in_array ( $ executionState , [ DeliveryExecutionState :: STATE_AWAITING , DeliveryExecutionState :: STATE_AUTHORIZED , ] ) && $ lastTestTakersEvent ) { /** @var \oat\taoProctoring\model\implementation\DeliveryExecutionStateService $deliveryExecutionStateService */ $ deliveryExecutionStateService = $ this -> getServiceLocator ( ) -> get ( DeliveryExecutionStateService :: SERVICE_ID ) ; $ delay = $ deliveryExecutionStateService -> getOption ( DeliveryExecutionStateService :: OPTION_CANCELLATION_DELAY ) ; $ lastTestEventTime = ( new DateTimeImmutable ( ) ) -> setTimestamp ( $ lastTestTakersEvent [ 'created_at' ] ) ; $ result = ( $ lastTestEventTime -> add ( new DateInterval ( $ delay ) ) < ( new DateTimeImmutable ( ) ) ) ; } return $ result ; }
Checks if delivery execution was abandoned after authorization

@param DeliveryExecution $deliveryExecution
@return bool
@throws
Checks if delivery execution was abandoned after authorization