Meneame::shareCount()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 3
nc 2
nop 1
1
<?php
2
3
namespace SocialLinks\Providers;
4
5
class Meneame extends ProviderBase implements ProviderInterface
6
{
7
    protected $domain = 'http://meneame.net';
8
9
    /**
10
     * {@inheritdoc}
11
     */
12
    public function shareUrl()
13
    {
14
        return $this->buildUrl(
15
            "{$this->domain}/submit.php",
16
            array('url')
17
        );
18
    }
19
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public function shareCountRequest()
24
    {
25
        return static::request(
26
            $this->buildUrl(
27
                "{$this->domain}/api/url.php",
28
                array('url')
29
            )
30
        );
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function shareCount($response)
37
    {
38
        $result = explode(' ', $response);
39
40
        if (isset($result[0]) && $result[0] === 'OK') {
41
            return intval($result[2]);
42
        }
43
44
        return 0;
45
    }
46
}
47