Passed
Pull Request — master (#10)
by Petro
02:29
created

Odnoklassniki   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildLink() 0 7 1
A processShareData() 0 6 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\AbstractDriver;
11
12
/**
13
 * Driver for Ok.ru
14
 *
15
 * @link https://ok.ru
16
 *
17
 * @author Petro Sokolnykov <[email protected]>
18
 * @since 2.0
19
 */
20
class Odnoklassniki extends AbstractDriver
21
{
22
    /**
23
     * @inheritdoc
24
     */
25
    protected function processShareData()
26
    {
27
        $this->url = static::encodeData($this->url);
28
        $this->title = static::encodeData($this->title);
29
        $this->description = static::encodeData($this->description);
30
        $this->imageUrl = static::encodeData($this->imageUrl);
31
    }
32
33
    /**
34
     * @inheritdoc
35
     */
36
    protected function buildLink()
37
    {
38
        return 'https://connect.ok.ru/offer'
39
            . '?url={url}'
40
            . '&title={title}'
41
            . '&description={description}'
42
            . '&imageUrl={imageUrl}';
43
    }
44
}
45