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

AbstractMailDriver::processShareData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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