Returns links to the invoice and packing slip documents.

@param string $token

@return array[]
Array with form field that contains links to documents related to this
invoice.
778609
private function getLinksField($token)
    {
        $uri = $this->service->getInvoicePdfUri($token);
        $text = ucfirst($this->t('invoice'));
        $title = sprintf($this->t('open_as_pdf'), $text);
        /** @noinspection HtmlUnknownTarget */
        $invoiceLink = sprintf('<a class="%4$s" href="%1$s" title="%3$s">%2$s</a>', $uri, $text, $title, 'pdf');

        $uri = $this->service->getPackingSlipUri($token);
        $text = ucfirst($this->t('packing_slip'));
        $title = sprintf($this->t('open_as_pdf'), $text);
        /** @noinspection HtmlUnknownTarget */
        $packingSlipLink = sprintf('<a class="%4$s" href="%1$s" title="%3$s">%2$s</a>', $uri, $text, $title, 'pdf');

        $fields = array(
            'links' => array(
                'type' => 'markup',
                'label' => $this->t('documents'),
                'value' => "$invoiceLink $packingSlipLink",
            ),
        );
        return $fields;
    }
179240
public function offsetGet($token)
    {
        if (isset($this->idf[$token])) {
            return $this->idf[$token];
        } else {
            return $this->logD;
        }
    }
862702
public static function getSpaceFromToken($token) {
        $pieces = explode('::', $token);
        if ( count($pieces) != 4 ) return false;
        $space = implode('::', array_slice($pieces,0,2));
        return $space;
    }
1248232
final public function getAttachments(): array
    {
        if (null === $this->attachments) {
            $this->attachments = self::gatherAttachments($this);
        }

        return $this->attachments;
    }
159671
protected static function parseOption($token)
    {
        $description = null;

        if (mb_strpos($token, ' : ') !== false) {
            list($token, $description) = explode(' : ', $token);
            $token = trim($token);
            $description = trim($description);
        }

        $shortcut = null;

        $matches = preg_split('/\s*\|\s*/', $token, 2);

        if (isset($matches[1])) {
            $shortcut = $matches[0];
            $token = $matches[1];
        }

        switch (true) {
            case Text::endsWith($token, '='):
                return new InputOption(trim($token, '='), $shortcut, InputOption::VALUE_OPTIONAL, $description);
            case Text::endsWith($token, '=*'):
                return new InputOption(trim($token, '=*'), $shortcut, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, $description);
            case preg_match('/(.+)\=(.+)/', $token, $matches):
                return new InputOption($matches[1], $shortcut, InputOption::VALUE_OPTIONAL, $description, $matches[2]);
            default:
                return new InputOption($token, $shortcut, InputOption::VALUE_NONE, $description);
        }
    }
418779
public function getAnswerDisplaySnippets(\Gems_Tracker_Token $token)
    {
        $this->token = $token;

        $snippets = (array) $token->getTrackEngine()->getAnswerSnippetNames();

        $snippets['answerFilter'] = $this;

        return $snippets;
    }
487019
public function getCard(string $token)
    {
        // Lof Debug
        $this->flow->getLogger()->debug("Retrieving Card with token $token");

        $resource = $this->make(
            $this->flow->send(
                'get',
                $this->endpoint . '/getRegisterStatus',
                ['token' => $token]
            )
        );

        $resource->setExists((int)$resource->status === 1);

        return $resource;
    }
163607
private function verify(string $token): array
    {
        $jsonConverter = new StandardConverter();
        $serializer = new JWSCompactSerializer($jsonConverter);
        $jws = $serializer->unserialize($token);
        $this->signatureHeaderCheckerManager->check($jws, 0);
        if (false === $this->jwsLoader->verifyWithKeySet($jws, $this->signatureKeyset, 0)) {
            throw new JWTDecodeFailureException('decoding_error', 'An error occurred while trying to verify the JWT token.');
        }
        $payload = $jsonConverter->decode($jws->getPayload());
        $this->claimCheckerManager->check($payload);

        return $payload;
    }
619469
protected function getRelatedDocumentsForAutocompleter()
    {
        $documents = DMSDocument::get()->exclude('ID', $this->ID);
        $this->extend('updateRelatedDocumentsForAutocompleter', $documents);
        return $documents;
    }
1017306
function GetExpressCheckoutDetails($token, $optional = array()) {
    $values = array_merge($optional, array('TOKEN' => $token));
    if ($this->_mode == 'payflow') {
      $values = array_merge($values, array('ACTION'  => 'G', /* ACTION=G denotes GetExpressCheckoutDetails */
                                           'TENDER'  => 'P',
                                           'TRXTYPE' => $this->_trxtype));
    }
    return $this->_request($values, 'GetExpressCheckoutDetails');
  }
824123
public function getActivationLink(Token $token)
    {
        $activationConfiguration = $token->getPreset()['activation'];
        $tokenHash = $token->getHash();

        if ($activationConfiguration['uri'] === null) {
            throw new \RuntimeException('Building activation link failed, no uri configuration is set', 1434728943);
        } elseif (is_array($activationConfiguration['uri'])) {
            $routerConfiguration = $activationConfiguration['uri'];

            $this->uriBuilder->setRequest($this->request);
            $uri = $this->uriBuilder
                ->setCreateAbsoluteUri(true)
                ->setFormat($routerConfiguration['@format'])
                ->uriFor(
                    $routerConfiguration['@action'],
                    $routerConfiguration['arguments'],
                    $routerConfiguration['@controller'],
                    $routerConfiguration['@package'],
                    $routerConfiguration['@subpackage']
                );
        } elseif (is_string($activationConfiguration['uri'])) {
            $uri = $activationConfiguration['uri'];
        } else {
            throw new \RuntimeException('Building activation link failed, uri configuration is invalid (neither array nor string)', 1434732898);
        }

        $this->logger->log(sprintf('Activation link built for token with hash %s', $tokenHash, $token->getIdentifier()), LOG_INFO);

        return str_replace('-tokenhash-', $tokenHash, $uri);
    }
589983
protected function getTokenData(Token $token)
    {
        return [
            'id' => $token->getId(),
            'expires' => $token->getExpiresAt()->format(\DateTime::ISO8601),
        ];
    }
1182144
public function getTransactionResult($token = null)
    {
        if (!$token) {
            $token = $_POST['token_ws'];
        }

        return $this->service->getTransactionResult($token)->return;
    }
844645
public function getLinks(): ?DocumentLinks
    {
        return DocumentLinks::createWithoutBaseUri()
            ->setPagination("/users", $this->object, $this->request->getUri()->getQuery());
    }
329201
public function downloadDemoToken($token)
    {
        $downloadableUrl = $this->downRepository->findByToken($token);
        $path = storage_path(
            'app/public' . DIRECTORY_SEPARATOR . $downloadableUrl->demo_path
        );

        return response()->download($path);
    }
593347
public function getRoundAnswerSnippets(\Gems_Tracker_Token $token)
    {
        $this->_ensureRounds();
        $roundId = $token->getRoundId();

        if (isset($this->_rounds[$roundId]['gro_display_event']) && $this->_rounds[$roundId]['gro_display_event']) {
            $event = $this->events->loadSurveyDisplayEvent($this->_rounds[$roundId]['gro_display_event']);

            return $event->getAnswerDisplaySnippets($token);
        }
    }
1044796
public static function document($doc)
    {
        $type = 1;
        $valid = self::cpf($doc);
        if ($valid == false) {
            $type = 2;
            $valid = self::cnpj($doc);
        }
        if ($valid == false) {
            return false;
        }
        return ['type' => $type, 'valid' => $valid];
    }