Product   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setDiscussion() 0 6 2
A setColors() 0 6 1
A setSize() 0 6 1
A setAvailability() 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 Product 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/product';
14
15
    /**
16
     * If set to false, will not extract article comments in a Discussion
17
     * entity embedded in the Product entity. By default, it will.
18
     * @param bool $bool
19
     * @return $this
20
     */
21 1
    public function setDiscussion($bool = true)
22
    {
23 1
        $this->otherOptions['discussion'] = ($bool) ? 'true' : 'false';
24
25 1
        return $this;
26
    }
27
28
    /**
29
     * @see Swader\Diffbot\Entity\Product::getColors()
30
     * @param bool|mixed $bool
31
     * @return $this
32
     */
33 2
    public function setColors($bool)
34
    {
35 2
        $this->fieldSettings['colors'] = (bool)$bool;
36
37 2
        return $this;
38
    }
39
40
    /**
41
     * @see Swader\Diffbot\Entity\Product::getSize()
42
     * @param bool|mixed $bool
43
     * @return $this
44
     */
45 2
    public function setSize($bool)
46
    {
47 2
        $this->fieldSettings['size'] = (bool)$bool;
48
49 2
        return $this;
50
    }
51
52
    /**
53
     * @see Swader\Diffbot\Entity\Product::isAvailable()
54
     * @param bool|mixed $bool
55
     * @return $this
56
     */
57 2
    public function setAvailability($bool)
58
    {
59 2
        $this->fieldSettings['availability'] = (bool)$bool;
60
61 2
        return $this;
62
    }
63
}
64