Article   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 2
cbo 2
dl 0
loc 60
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setSentiment() 0 6 1
A setPaging() 0 6 2
A setMaxTags() 0 6 1
A setDiscussion() 0 6 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