Adapter::displayName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipbox/postmark/blob/master/LICENSE.md
6
 * @link       https://github.com/flipbox/postmark
7
 */
8
9
namespace flipbox\postmark;
10
11
use Craft;
12
use craft\mail\transportadapters\BaseTransportAdapter;
13
14
/**
15
 * @author Flipbox Factory <[email protected]>
16
 * @since 1.0.0
17
 */
18
class Adapter extends BaseTransportAdapter
19
{
20
    /**
21
     * @inheritdoc
22
     */
23
    public static function displayName(): string
24
    {
25
        return 'Postmark';
26
    }
27
28
    /**
29
     * @var string
30
     */
31
    public $token;
32
33
    /**
34
     * @inheritdoc
35
     */
36
    public function attributeLabels()
37
    {
38
        return [
39
            'token' => Craft::t('postmark', 'Token')
40
        ];
41
    }
42
43
    /**
44
     * @inheritdoc
45
     */
46
    public function rules()
47
    {
48
        return [
49
            [
50
                [
51
                    'token'
52
                ],
53
                'required'
54
            ]
55
        ];
56
    }
57
58
    /**
59
     * @inheritdoc
60
     */
61
    public function getSettingsHtml()
62
    {
63
        return Craft::$app->getView()->renderTemplate('postmark/settings', [
64
            'adapter' => $this
65
        ]);
66
    }
67
68
    /**
69
     * @inheritdoc
70
     */
71
    public function defineTransport()
72
    {
73
        return [
74
            'class' => Transport::class,
75
            'constructArgs' => [$this->token]
76
        ];
77
    }
78
}
79