Completed
Push — master ( 69cae2...0f037f )
by Vladimir
03:08
created

AbstractMailDriver   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A processShareData() 0 8 1
1
<?php
2
/**
3
 * @link https://github.com/yiimaker/yii2-social-share
4
 * @copyright Copyright (c) 2017 Yii Maker
5
 * @license BSD 3-Clause License
6
 */
7
8
namespace ymaker\social\share\base;
9
10
/**
11
 * Base class for drivers for mail services like Gmail and Yahoo.
12
 *
13
 * @author Vladimir Kuprienko <[email protected]>
14
 * @since 2.0
15
 */
16
abstract class AbstractMailDriver extends AbstractDriver
17
{
18
    /**
19
     * @var string
20
     */
21
    public $bodyPattern = '{description} - {url}';
22
23
24
    /**
25
     * @inheritdoc
26
     */
27
    protected function processShareData()
28
    {
29
        $this->title = static::encodeData($this->title);
30
31
        $this->appendToData('body', strtr($this->bodyPattern, [
32
            '{url}'         => $this->url,
33
            '{description}' => $this->description,
34
            '{imageUrl}'    => $this->imageUrl,
35
        ]));
36
    }
37
}
38