Completed
Push — master ( 7c1383...8fd89c )
by Cheren
05:32
created

Email   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 36
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sendCreateMessage() 0 10 1
A _initialize() 0 4 1
1
<?php
2
/**
3
 * CakeCMS Community
4
 *
5
 * This file is part of the of the simple cms based on CakePHP 3.
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @package     Community
10
 * @license     MIT
11
 * @copyright   MIT License http://www.opensource.org/licenses/mit-license.php
12
 * @link        https://github.com/CakeCMS/Community".
13
 * @author      Sergey Kalistratov <[email protected]>
14
 */
15
16
namespace Community\Notify;
17
18
use JBZoo\Data\Data;
19
use Extensions\Plugin;
20
use Core\Utility\Macros;
21
use Community\Model\Entity\User;
22
use Core\Notify\Email as CoreEmail;
23
24
/**
25
 * Class Email
26
 *
27
 * @package  Community\Notify
28
 * @property User $_data
29
 */
30
class Email extends CoreEmail
31
{
32
33
    /**
34
     * Plugin params.
35
     *
36
     * @var Data
37
     */
38
    protected $_params;
39
40
    /**
41
     * Send user create account profile message / set password.
42
     *
43
     * @return  array
44
     */
45
    public function sendCreateMessage()
46
    {
47
        $from    = Plugin::getParams('Core')->get('admin_email');
48
        $macros  = new Macros($this->_data);
49
        $message = $this->_params->get('msg_account_create_msg');
50
        $message = $macros->text($message);
51
        $subject = $this->_params->get('msg_account_create_subject');
52
53
        return $this->send($subject, $message, $this->_data->email, null, $from);
54
    }
55
56
    /**
57
     * Constructor hook method.
58
     *
59
     * @return  void
60
     */
61
    protected function _initialize()
62
    {
63
        $this->_params = Plugin::getParams('Community');
64
    }
65
}
66