Completed
Pull Request — master (#48)
by
unknown
06:19
created

DocumentationLinks::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 1
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
        'profile_id' => '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
    public function getProfileIdDoc(): string
64
    {
65
        return \sprintf('%s <a target="_blank" href="%s"> %s </a>',
66
                $this->translator->trans('bitbag_sylius_mollie_plugin.ui.you_can_find_you_profile_id'),
67
                self::DOCUMENTATION_LINKS['profile_id'],
68
                $this->translator->trans('bitbag_sylius_mollie_plugin.ui.mollie_profile_id')
69
        );
70
    }
71
}
72