Article::setPaging()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
crap 2
1
<?php
2
3
namespace Swader\Diffbot\Api;
4
5
use Swader\Diffbot\Abstracts\Api;
6
use Swader\Diffbot\Traits\StandardApi;
7
8
class Article 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/article';
14
15
    /**
16
     * @see Swader\Diffbot\Entity\Article::getSentiment()
17
     * @param bool|mixed $bool
18
     * @return $this
19
     */
20 1
    public function setSentiment($bool)
21
    {
22 1
        $this->fieldSettings['sentiment'] = (bool)$bool;
23
24 1
        return $this;
25
    }
26
27
    /**
28
     * If set to false, Diffbot will not auto-concat several pages of a
29
     * multi-page article into one. Defaults to true, max 20 pages.
30
     *
31
     * @see http://support.diffbot.com/automatic-apis/handling-multiple-page-articles/
32
     * @param bool $bool
33
     * @return $this
34
     */
35 2
    public function setPaging($bool = true)
36
    {
37 2
        $this->otherOptions['paging'] = ($bool) ? 'true' : 'false';
38
39 2
        return $this;
40
    }
41
42
    /**
43
     * Set the maximum number of automatically-generated tags to return.
44
     * By default a maximum of five tags will be returned.
45
     * @param int $max
46
     * @return $this
47
     */
48 2
    public function setMaxTags($max = 5)
49
    {
50 2
        $this->otherOptions['maxTags'] = (int)$max;
51
52 2
        return $this;
53
    }
54
55
    /**
56
     * If set to false, will not extract article comments in a Discussion
57
     * entity embedded in the Article entity. By default, it will.
58
     * @param bool $bool
59
     * @return $this
60
     */
61 2
    public function setDiscussion($bool = true)
62
    {
63 2
        $this->otherOptions['discussion'] = ($bool) ? 'true' : 'false';
64
65 2
        return $this;
66
    }
67
}
68