Passed
Pull Request — master (#47)
by
unknown
08:38
created

DocumentationLinks::getApiKeyDoc()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
c 0
b 0
f 0
dl 0
loc 7
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusMolliePlugin\Documentation;
14
15
use Symfony\Contracts\Translation\TranslatorInterface;
16
17
final class DocumentationLinks implements DocumentationLinksInterface
18
{
19
    public const DOCUMENTATION_LINKS = [
20
        'single_click' => 'https://help.mollie.com/hc/en-us/articles/115000671249-What-are-single-click-payments-and-how-does-it-work-',
21
        'mollie_components' => 'https://www.mollie.com/en/news/post/better-checkout-flows-with-mollie-components',
22
        'payment_methods' => 'https://docs.mollie.com/orders/why-use-orders',
23
        'api_key' => 'https://www.mollie.com/dashboard/developers/api-keys',
24
    ];
25
26
    /** @var TranslatorInterface */
27
    private $translator;
28
29
    public function __construct(TranslatorInterface $translator)
30
    {
31
        $this->translator = $translator;
32
    }
33
34
    public function getSingleClickDoc(): string
35
    {
36
        $link = \sprintf('<a target="_blank" href="%s"> %s </a>', self::DOCUMENTATION_LINKS['single_click'],
37
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.mollie_single_click'));
38
39
        return $this->translator->trans('bitbag_sylius_mollie_plugin.ui.read_more_single_click_enabled', [
40
            '%link%' => $link,
41
        ]);
42
    }
43
44
    public function getMollieComponentsDoc(): string
45
    {
46
        $link = \sprintf('<a target="_blank" href="%s"> %s </a>', self::DOCUMENTATION_LINKS['mollie_components'],
47
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.mollie_components'));
48
49
        return $this->translator->trans('bitbag_sylius_mollie_plugin.ui.read_more_enable_components', [
50
            '%link%' => $link,
51
        ]);
52
    }
53
54
    public function getPaymentMethodDoc(): string
55
    {
56
        return \sprintf('%s <a target="_blank" href="%s"> %s </a> %s',
57
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.click'),
58
            self::DOCUMENTATION_LINKS['payment_methods'],
59
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.here'),
60
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.payment_methods_doc')
61
        );
62
    }
63
64
    public function getApiKeyDoc(): string
65
    {
66
        return \sprintf('%s <a target="_blank" href="%s"> %s </a> %s',
67
        $this->translator->trans('bitbag_sylius_mollie_plugin.ui.find_you_api_key'),
68
        self::DOCUMENTATION_LINKS['api_key'],
69
        $this->translator->trans('bitbag_sylius_mollie_plugin.ui.mollie_profile'),
70
        $this->translator->trans('bitbag_sylius_mollie_plugin.ui.it_starts_with')
71
        );
72
    }
73
}
74