DocumentationLinks   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 38
dl 0
loc 73
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getApiKeyDoc() 0 8 1
A getProfileIdDoc() 0 7 1
A __construct() 0 3 1
A getSingleClickDoc() 0 10 1
A getPaymentMethodDoc() 0 8 1
A getMollieComponentsDoc() 0 10 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
 * You can find more information about us on https://bitbag.io and write us
7
 * an email on [email protected].
8
 */
9
10
declare(strict_types=1);
11
12
namespace BitBag\SyliusMolliePlugin\Documentation;
13
14
use Symfony\Contracts\Translation\TranslatorInterface;
15
16
final class DocumentationLinks implements DocumentationLinksInterface
17
{
18
    public const DOCUMENTATION_LINKS = [
19
        'single_click' => 'https://help.mollie.com/hc/en-us/articles/115000671249-What-are-single-click-payments-and-how-does-it-work-',
20
        'mollie_components' => 'https://www.mollie.com/en/news/post/better-checkout-flows-with-mollie-components',
21
        'payment_methods' => 'https://docs.mollie.com/orders/why-use-orders',
22
        'profile_id' => 'https://www.mollie.com/dashboard/developers/api-keys',
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(
37
            '<a target="_blank" href="%s"> %s </a>',
38
            self::DOCUMENTATION_LINKS['single_click'],
39
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.mollie_single_click')
40
        );
41
42
        return $this->translator->trans('bitbag_sylius_mollie_plugin.ui.read_more_single_click_enabled', [
43
            '%link%' => $link,
44
        ]);
45
    }
46
47
    public function getMollieComponentsDoc(): string
48
    {
49
        $link = \sprintf(
50
            '<a target="_blank" href="%s"> %s </a>',
51
            self::DOCUMENTATION_LINKS['mollie_components'],
52
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.mollie_components')
53
        );
54
55
        return $this->translator->trans('bitbag_sylius_mollie_plugin.ui.read_more_enable_components', [
56
            '%link%' => $link,
57
        ]);
58
    }
59
60
    public function getPaymentMethodDoc(): string
61
    {
62
        return \sprintf(
63
            '%s <a target="_blank" href="%s"> %s </a> %s',
64
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.click'),
65
            self::DOCUMENTATION_LINKS['payment_methods'],
66
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.here'),
67
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.payment_methods_doc')
68
        );
69
    }
70
71
    public function getProfileIdDoc(): string
72
    {
73
        return \sprintf(
74
            '%s <a target="_blank" href="%s"> %s </a>',
75
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.you_can_find_you_profile_id'),
76
            self::DOCUMENTATION_LINKS['profile_id'],
77
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.mollie_profile_id')
78
        );
79
    }
80
81
    public function getApiKeyDoc(): string
82
    {
83
        return \sprintf(
84
            '%s <a target="_blank" href="%s"> %s </a> %s',
85
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.find_you_api_key'),
86
            self::DOCUMENTATION_LINKS['api_key'],
87
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.mollie_profile'),
88
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.it_starts_with')
89
        );
90
    }
91
}
92