Postmark::info()   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 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 2
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\base\Plugin;
13
use craft\events\RegisterComponentTypesEvent;
14
use craft\helpers\MailerHelper;
15
use yii\base\Event;
16
17
/**
18
 * @author Flipbox Factory <[email protected]>
19
 * @since 1.0.0
20
 */
21
class Postmark extends Plugin
22
{
23
    /**
24
     * @inheritdoc
25
     */
26
    public function init()
27
    {
28
        parent::init();
29
30
        Event::on(
31
            MailerHelper::class,
32
            MailerHelper::EVENT_REGISTER_MAILER_TRANSPORT_TYPES,
33
            function (RegisterComponentTypesEvent $event) {
34
                $event->types[] = Adapter::class;
35
            }
36
        );
37
    }
38
39
    /**
40
     * Logs an informative message.
41
     *
42
     * @param $message
43
     * @param string $category
44
     */
45
    public static function info($message, $category = 'postmark')
46
    {
47
        Craft::info($message, $category);
48
    }
49
50
    /**
51
     * Logs a warning message.
52
     *
53
     * @param $message
54
     * @param string $category
55
     */
56
    public static function warning($message, $category = 'postmark')
57
    {
58
        Craft::warning($message, $category);
59
    }
60
61
    /**
62
     * Logs an error message.
63
     *
64
     * @param $message
65
     * @param string $category
66
     */
67
    public static function error($message, $category = 'postmark')
68
    {
69
        Craft::error($message, $category);
70
    }
71
}
72