Facebook   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 9
c 2
b 0
f 0
dl 0
loc 29
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A processShareData() 0 3 1
A getMetaTags() 0 8 1
A buildLink() 0 3 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 Facebook.
15
 *
16
 * @see https://facebook.com
17
 *
18
 * @author Vladimir Kuprienko <[email protected]>
19
 *
20
 * @since 1.0
21
 */
22
class Facebook extends AbstractDriver
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    protected function processShareData()
28
    {
29
        $this->url = static::encodeData($this->url);
30
    }
31
32
    /**
33
     * {@inheritdoc}
34
     */
35
    protected function buildLink()
36
    {
37
        return 'http://www.facebook.com/sharer.php?u={url}';
38
    }
39
40
    /**
41
     * @return array
42
     */
43
    protected function getMetaTags()
44
    {
45
        return [
46
            ['property' => 'og:url',         'content' => '{url}'],
47
            ['property' => 'og:type',        'content' => 'website'],
48
            ['property' => 'og:title',       'content' => '{title}'],
49
            ['property' => 'og:description', 'content' => '{description}'],
50
            ['property' => 'og:image',       'content' => '{imageUrl}'],
51
        ];
52
    }
53
}
54