Completed
Pull Request — master (#38)
by
unknown
05:44
created

DocumentationLinks   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 20
c 1
b 0
f 0
dl 0
loc 43
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A getSingleClickDoc() 0 7 1
A getPaymentMethodDoc() 0 7 1
A getMollieComponentsDoc() 0 7 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
    ];
24
25
    /** @var TranslatorInterface */
26
    private $translator;
27
28
    public function __construct(TranslatorInterface $translator)
29
    {
30
        $this->translator = $translator;
31
    }
32
33
    public function getSingleClickDoc(): string
34
    {
35
        $link = \sprintf('<a target="_blank" href="%s"> %s </a>', self::DOCUMENTATION_LINKS['single_click'],
36
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.mollie_single_click'));
37
38
        return $this->translator->trans('bitbag_sylius_mollie_plugin.ui.read_more_single_click_enabled', [
39
            '%link%' => $link,
40
        ]);
41
    }
42
43
    public function getMollieComponentsDoc(): string
44
    {
45
        $link = \sprintf('<a target="_blank" href="%s"> %s </a>', self::DOCUMENTATION_LINKS['mollie_components'],
46
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.mollie_components'));
47
48
        return $this->translator->trans('bitbag_sylius_mollie_plugin.ui.read_more_enable_components', [
49
            '%link%' => $link,
50
        ]);
51
    }
52
53
    public function getPaymentMethodDoc(): string
54
    {
55
        return \sprintf('%s <a target="_blank" href="%s"> %s </a> %s',
56
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.click'),
57
            self::DOCUMENTATION_LINKS['payment_methods'],
58
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.here'),
59
            $this->translator->trans('bitbag_sylius_mollie_plugin.ui.payment_methods_doc'));
60
    }
61
}
62