Code Duplication    Length = 39-40 lines in 2 locations

src/Providers/Pinterest.php 1 location

@@ 5-44 (lines=40) @@
2
3
namespace SocialLinks\Providers;
4
5
class Pinterest extends ProviderBase implements ProviderInterface
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10
    public function shareUrl()
11
    {
12
        return $this->buildUrl(
13
            'https://www.pinterest.com/pin/create/button/',
14
            array(
15
                'url',
16
                'title' => 'description',
17
                'image' => 'media',
18
            )
19
        );
20
    }
21
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function shareCountRequest()
26
    {
27
        return static::request(
28
            $this->buildUrl(
29
                'https://api.pinterest.com/v1/urls/count.json',
30
                array('url')
31
            )
32
        );
33
    }
34
35
    /**
36
     * {@inheritdoc}
37
     */
38
    public function shareCount($response)
39
    {
40
        $count = static::jsonpResponse($response);
41
42
        return isset($count['count']) ? intval($count['count']) : 0;
43
    }
44
}
45

src/Providers/Stumbleupon.php 1 location

@@ 5-43 (lines=39) @@
2
3
namespace SocialLinks\Providers;
4
5
class Stumbleupon extends ProviderBase implements ProviderInterface
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10
    public function shareUrl()
11
    {
12
        return $this->buildUrl(
13
            'https://www.stumbleupon.com/submit',
14
            array(
15
                'url',
16
                'title',
17
            )
18
        );
19
    }
20
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function shareCountRequest()
25
    {
26
        return static::request(
27
            $this->buildUrl(
28
                'http://www.stumbleupon.com/services/1.01/badge.getinfo',
29
                array('url')
30
            )
31
        );
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function shareCount($response)
38
    {
39
        $count = static::jsonResponse($response);
40
41
        return isset($count['result']['views']) ? intval($count['result']['views']) : 0;
42
    }
43
}
44