Passed
Push — master ( abe9d4...f9c79d )
by Vladimir
04:18
created

Gmail   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A processShareData() 0 7 1
A buildLink() 0 3 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\drivers;
9
10
use ymaker\social\share\base\DriverAbstract;
11
12
/**
13
 * DriverAbstract for Gmail.
14
 * @link https://gmail.google.com
15
 *
16
 * @author Vladimir Kuprienko <[email protected]>
17
 * @since 1.0
18
 */
19
class Gmail extends DriverAbstract
20
{
21
    /**
22
     * @var string
23
     */
24
    public $bodyPattern = '{description} - {url}';
25
26
27
    /**
28
     * @inheritdoc
29
     */
30
    protected function processShareData()
31
    {
32
        $this->title = static::encodeData($this->title);
33
        $this->appendToData('body', strtr($this->bodyPattern, [
34
            '{url}'         => $this->url,
35
            '{description}' => $this->description,
36
            '{imageUrl}'    => $this->imageUrl
37
        ]));
38
    }
39
40
    /**
41
     * @inheritdoc
42
     */
43
    protected function buildLink()
44
    {
45
        return 'https://mail.google.com/mail/?view=cm&fs=1&su={title}&body={body}';
46
    }
47
}
48