Linkedin::shareCount()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
namespace SocialLinks\Providers;
4
5
class Linkedin extends ProviderBase implements ProviderInterface
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10
    public function shareUrl()
11
    {
12
        return $this->buildUrl(
13
            'https://www.linkedin.com/shareArticle',
14
            array(
15
                'url',
16
                'title',
17
                'text' => 'summary',
18
            ),
19
            array('mini' => true)
20
        );
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function shareCountRequest()
27
    {
28
        return static::request(
29
            $this->buildUrl(
30
                'https://www.linkedin.com/countserv/count/share',
31
                array('url'),
32
                array('format' => 'json')
33
            )
34
        );
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function shareCount($response)
41
    {
42
        $count = self::jsonResponse($response);
43
44
        return isset($count['count']) ? intval($count['count']) : 0;
45
    }
46
}
47