Facebook   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A shareUrl() 0 14 1
A shareCountRequest() 0 12 1
A shareCount() 0 6 2
1
<?php
2
3
namespace SocialLinks\Providers;
4
5
class Facebook extends ProviderBase implements ProviderInterface
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10
    public function shareUrl()
11
    {
12
        return $this->buildUrl(
13
            'https://www.facebook.com/sharer/sharer.php',
14
            array(
15
                'url' => 'u',
16
                'title' => 't',
17
            ),
18
            array(
19
                'display' => 'popup',
20
                'redirect_uri' => 'http://www.facebook.com',
21
            )
22
        );
23
    }
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function shareCountRequest()
29
    {
30
        return static::request(
31
            $this->buildUrl(
32
                'https://graph.facebook.com/',
33
                array(),
34
                array(
35
                    'id' => $this->page->getUrl(),
36
                )
37
            )
38
        );
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function shareCount($response)
45
    {
46
        $count = self::jsonResponse($response);
47
48
        return isset($count['share']['share_count']) ? intval($count['share']['share_count']) : 0;
49
    }
50
}
51