Returns a human readable test representation of the delivery execution
Should respect the current user's language

@return string
@throws \common_exception_NotFound
977256
public function getLabel()
    {
        /** @var DeliveryFieldsService $deliveryFieldsService */
        $deliveryFieldsService = $this->getServiceLocator()->get(DeliveryFieldsService::SERVICE_ID);
        $label = $deliveryFieldsService->getLabel(
            $this->getImplementation()->getDelivery(),
            $this->getImplementation()->getLabel()
        );
        return $label;
    }
249739
protected function getSendStatusText()
    {
        switch ($this->sendStatus) {
            case self::NotSent_WrongStatus:
                $message = empty($this->sendStatusArguments)
                    ? 'reason_not_sent_triggerCreditNoteEvent_None'
                    : 'reason_not_sent_wrongStatus';
                break;
            case self::NotSent_AlreadySent:
                $message = 'reason_not_sent_alreadySent';
                break;
            case self::NotSent_LockedForSending:
                $message = 'reason_not_sent_alreadySending';
                break;
            case self::NotSent_EventInvoiceCreated:
                $message = 'reason_not_sent_prevented_invoiceCreated';
                break;
            case self::NotSent_EventInvoiceCompleted:
                $message = 'reason_not_sent_prevented_invoiceCompleted';
                break;
            case self::NotSent_EmptyInvoice:
                $message = 'reason_not_sent_empty_invoice';
                break;
            case self::NotSent_TriggerInvoiceCreateNotEnabled:
                $message = 'reason_not_sent_not_enabled_triggerInvoiceCreate';
                break;
            case self::NotSent_TriggerInvoiceSentNotEnabled:
                $message = 'reason_not_sent_not_enabled_triggerInvoiceSent';
                break;
            case self::NotSent_LocalErrors:
                $message = 'reason_not_sent_local_errors';
                break;
            case self::NotSent_DryRun:
                $message = 'reason_not_sent_dry_run';
                break;
            case self::Send_TestMode:
                $message = 'reason_sent_testMode';
                break;
            case self::Send_New:
                $message = empty($this->sendStatusArguments)
                    ? 'reason_sent_new'
                    : 'reason_sent_new_status_change';
                break;
            case self::Send_LockExpired:
                $message = 'reason_sent_lock_expired';
                break;
            case self::Send_Forced:
                $message = 'reason_sent_forced';
                break;
            default:
                $message = 'reason_unknown';
                $this->sendStatusArguments = array(($this->sendStatus));
                break;
        }
        $message = $this->t($message);
        if (!empty($this->sendStatusArguments)) {
            $message = vsprintf($message, $this->sendStatusArguments);
        }
        return $message;
    }
817662
protected function getExceptionMessage(): string
    {
        $exception = $this->getException();

        if ($exception instanceof UserException) {
            return $exception->getMessage();
        }

        return $this->getDefaultMessage();
    }
1361249
public function getSummaryMessage(): string {
        if ($main = $this->getMainMessage()) {
            return $main;
        } elseif ($this->isValid()) {
            return $this->translate('Validation succeeded.');
        } else {
            return $this->translate('Validation failed.');
        }
    }
923127
public function getQueuedStateText()
    {
        switch ((int)$this->getAttribute('queue_state')) {
            case self::QUEUE_NA:
                return '';
            case self::QUEUE_DONE:
                return 'done';
            case self::QUEUE_WAITING:
                return 'waiting';
            case self::QUEUE_WORKING:
                return 'working';
            default:
                return 'unknown';
        }
    }
133506
public function deliverAllInOne()
    {
        $contents = file_get_contents( __DIR__."/../../../public/js/localization.min.js" );
        $contents .= "\n";
        $contents .= $this->getMessagesJson();
        $contents .= $this->getConfigJson();

        /** @var \Illuminate\Http\Response $response */
        $response = response($contents);
        $response->header('Content-Type', 'text/javascript');

        if (ConfigCachingService::isDisabled()) {
            $response->setEtag(md5($contents));
        } else {
            $response->setLastModified(MessageCachingService::getLastRefreshTimestamp());
        }

        return $response;
    }
205020
public function get_user_language()
    {
        if (is_object($this->user)) {
            return $this->user->language;
        }
        else if (isset($_SESSION['language'])) {
            return $_SESSION['language'];
        }
    }
928151
public function generate()
    {
        try {
            if (!$this->hasRequestParameter(self::REST_DELIVERY_TEST_ID)) {
                throw new \common_exception_MissingParameter(self::REST_DELIVERY_TEST_ID, $this->getRequestURI());
            }

            $test = $this->getResource($this->getRequestParameter(self::REST_DELIVERY_TEST_ID));
            if (!$test->exists()) {
                throw new \common_exception_NotFound('Unable to find a test associated to the given uri.');
            }

            $label = 'Delivery of ' . $test->getLabel();
            $deliveryClass = $this->getDeliveryClassByParameters();

            $deliveryFactory = $this->getServiceManager()->get(DeliveryFactory::SERVICE_ID);
            /** @var \common_report_Report $report */
            $report = $deliveryFactory->create($deliveryClass, $test, $label);

            if ($report->getType() == \common_report_Report::TYPE_ERROR) {
                $this->logInfo('Unable to generate delivery execution ' .
                    'into taoDeliveryRdf::RestDelivery for test uri ' . $test->getUri());
                throw new \common_Exception('Unable to generate delivery execution.');
            }
            $delivery = $report->getData();

            /** @var DeliveryFactory $deliveryFactoryService */
            $deliveryFactoryService = $this->getServiceManager()->get(DeliveryFactory::SERVICE_ID);
            $initialProperties = $deliveryFactoryService->getInitialPropertiesFromRequest($this->getRequest());
            $delivery = $deliveryFactoryService->setInitialProperties($initialProperties, $delivery);
            $this->returnSuccess(array('delivery' => $delivery->getUri()));
        } catch (\Exception $e) {
            $this->returnFailure($e);
        }
    }
1138388
public function getSessionLg()
    {

        $sessionLang = \common_session_SessionManager::getSession()->getDataLanguage();
        if (empty($sessionLang)) {
            throw new Exception('the data language of the user cannot be found in session');
        }

        return (string)$sessionLang;
    }
365873
public function getCodeAsString()
    {
        switch ($this->getCode()) {
            case self::BURIED:
                return 'Buried';
                break;

            case self::NOT_FOUND:
                return 'Not Found';
                break;

            case self::EXPECTED_CRLF:
                return 'Expected CRLF';
                break;

            case self::JOB_TOO_BIG:
                return 'Job Too Big';
                break;

            case self::DEADLINE_SOON:
                return 'Deadline Soon';
                break;

            case self::TIMED_OUT:
                return 'Timed Out';
                break;

            case self::TUBE_NAME_TOO_LONG:
                return 'Tube Name Too Long';
                break;

            case self::NOT_IGNORED:
                return 'Not Ignored';
                break;

            case self::OUT_OF_MEMORY:
                return 'Out of Memory';
                break;

            case self::INTERNAL_ERROR:
                return 'Internal Error';
                break;

            case self::BAD_FORMAT:
                return 'Bad Format';
                break;

            case self::UNKNOWN_COMMAND:
                return 'Unknown Command';
                break;

            case self::SERVER_OFFLINE:
                return 'Server Offline';
                break;

            case self::SERVER_READ:
                return 'Server Read Error';
                break;

            case self::SERVER_WRITE:
                return 'Server Write Error';
                break;

            default:
                return 'Unknown';
                break;
        }
    }
334113
protected function getFormalSalutation()
    {
        $contact = $this->application->getContact();
        $name    = $contact->getLastName();
        $gender  = $contact->getGender();
        $translator = $this->getTranslator();
        
        $salutation = 'male' == $gender
                    ? $translator->translate('Dear Mr. %s')
                    : $translator->translate('Dear Ms. %s');
        
        return sprintf($salutation, $name);
    }
247881
public function getTitle()
    {
        $sTitle = 'FORGOT_PASSWORD';

        if ($this->showUpdateScreen()) {
            $sTitle = 'NEW_PASSWORD';
        } elseif ($this->updateSuccess()) {
            $sTitle = 'CHANGE_PASSWORD';
        }

        return \OxidEsales\Eshop\Core\Registry::getLang()->translateString($sTitle, \OxidEsales\Eshop\Core\Registry::getLang()->getBaseLanguage(), false);
    }
286372
protected function getSectionTextPlain()
    {
        if ($this->_text_encoding == 'quoted-printable') {
            return EmailHelper::qpContentTransferEncode($this->_text_plain)."\r\n";
        } elseif ($this->_text_encoding == 'base64') {
            // don't add CRLF if using base64 - spam filters don't
            // like this
            return EmailHelper::base64ContentTransferEncode($this->_text_plain);
        }

        return $this->_text_plain."\r\n";
    }
1077766
public function checkUnicodeSupport()
    {
        if (null === self::$unicodeEnabled) {
            self::$unicodeEnabled = (@preg_match('/\pL/u', 'a')) ? true : false;
        }

        return self::$unicodeEnabled;
    }
739322
public function getLanguage()
    {
        if ($this->project->getEmailMultiLanguage() && $this->language) {
            return $this->language;
        } else {
            return $this->project->getLocaleDefault();
        }
    }
1143483
function current() {
        $deliveryExecution = ServiceProxy::singleton()->getDeliveryExecution($this->instanceCache[$this->currentInstance]);
        return $this->createDocument($deliveryExecution);
    }
584138
public function getCharset() {
		if (!isset($this->charset)) {
			$numOfMatches = preg_match('/charset\s*=([^;]*)/', $this->getHeader('Content-Type'), $matches);
			if ($numOfMatches) {
				$this->charset = trim($matches[1]);
			} else {
				$this->charset = '';
			}
		}
		return $this->charset;
	}