Pinterest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 21
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A processShareData() 0 5 1
A buildLink() 0 6 1
1
<?php
2
3
/**
4
 * @link https://github.com/yiimaker/yii2-social-share
5
 * @copyright Copyright (c) 2017-2021 Volodymyr Kupriienko
6
 * @license BSD 3-Clause License
7
 */
8
9
namespace ymaker\social\share\drivers;
10
11
use ymaker\social\share\base\AbstractDriver;
12
13
/**
14
 * Driver for Pinterest.
15
 *
16
 * @see https://pinterest.com
17
 *
18
 * @author Vladimir Kuprienko <[email protected]>
19
 *
20
 * @since 1.0
21
 */
22
class Pinterest extends AbstractDriver
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected function processShareData()
28
    {
29
        $this->url = static::encodeData($this->url);
30
        $this->imageUrl = static::encodeData($this->imageUrl);
31
        $this->description = static::encodeData($this->description);
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    protected function buildLink()
38
    {
39
        return 'https://www.pinterest.com/pin/create/link/?'
40
            . 'url={url}'
41
            . '&media={imageUrl}'
42
            . '&description={description}';
43
    }
44
}
45