Discussion   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 2
cbo 2
dl 0
loc 38
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setMaxPages() 0 8 3
A setSentiment() 0 6 1
1
<?php
2
3
namespace Swader\Diffbot\Api;
4
5
use Swader\Diffbot\Abstracts\Api;
6
use Swader\Diffbot\Traits\StandardApi;
7
8
class Discussion extends Api
9
{
10
    use StandardApi;
11
12
    /** @var string API URL to which to send the request */
13
    protected $apiUrl = 'https://api.diffbot.com/v3/discussion';
14
15
    /**
16
     * Set the maximum number of pages in a thread to automatically concatenate
17
     * in a single response. Default = 1 (no concatenation). Set maxPages=all
18
     * to retrieve all pages of a thread regardless of length. Each individual
19
     * page will count as a separate API call.
20
     *
21
     * @param int|string $max Integer or "all"
22
     * @return $this
23
     */
24 2
    public function setMaxPages($max = 1)
25
    {
26 2
        if ($max == 'all' || is_numeric($max)) {
27 2
            $this->otherOptions['maxPages'] = $max;
28 2
        }
29
30 2
        return $this;
31
    }
32
33
    /**
34
     * @see Swader\Diffbot\Entity\Discussion::getSentiment()
35
     * @param bool|mixed $bool
36
     * @return $this
37
     */
38 1
    public function setSentiment($bool)
39
    {
40 1
        $this->fieldSettings['sentiment'] = (bool)$bool;
41
42 1
        return $this;
43
    }
44
45
}
46