Completed
Push — master ( 3afd02...a4590b )
by Vojta
04:54
created

BaseMailer::getTemplateIdent()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 2
eloc 7
nc 2
nop 1
1
<?php namespace VojtaSvoboda\Reservations\Mailers;
2
3
use App;
4
use Config;
5
6
class BaseMailer
7
{
8
    /** Default template locale. */
9
    const DEFAULT_TEMPLATE_LOCALE = 'en';
10
11
    /**
12
     * Get template ident by locale.
13
     *
14
     * @param string $name
15
     *
16
     * @return string
17
     */
18
    public function getTemplateIdent($name)
19
    {
20
        $locale = App::getLocale();
21
        $identBase = 'vojtasvoboda.reservations::mail.' . $name . '-';
22
        $ident = $identBase . $locale;
23
24
        if (file_exists(__DIR__ . '/../views/mail/' . $ident . '.htm')) {
25
            return $ident;
26
        }
27
28
        return $identBase . self::DEFAULT_TEMPLATE_LOCALE;
29
    }
30
31
    /**
32
     * Init recipients array.
33
     *
34
     * @return array
35
     */
36
    public function initRecipients()
37
    {
38
        $recipients = [];
39
        $recipients['bcc_email'] = Config::get('vojtasvoboda.reservations::config.mail.bcc_email');
40
        $recipients['bcc_name'] = Config::get('vojtasvoboda.reservations::config.mail.bcc_name');
41
42
        return $recipients;
43
    }
44
}
45