Completed
Pull Request — develop (#2)
by Adam
01:57
created

AbstractRequest::getVersion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Abstract Tone Request class
4
 */
5
namespace IBM\Watson\ToneAnalyzer\Message;
6
use IBM\Watson\Common\Message\AbstractRequest as BaseAbstractRequest;
7
8
/**
9
 * Abstract Tone Request class
10
 * @see BaseAbstractRequest
11
 */
12
abstract class AbstractRequest extends BaseAbstractRequest
13
{
14
    /**
15
     * Default API version
16
     */
17
    const DEFAULT_VERSION = '2016-05-19';
18
19
    /**
20
     * @var string
21
     */
22
    protected $endpoint = 'https://gateway.watsonplatform.net/tone-analyzer/api/v3';
23
24
    /**
25
     * Get API version
26
     *
27
     * @return string
28
     */
29
    public function getVersion()
30
    {
31
        return $this->getParameter('version', self::DEFAULT_VERSION);
0 ignored issues
show
Unused Code introduced by
The call to AbstractRequest::getParameter() has too many arguments starting with self::DEFAULT_VERSION.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
32
    }
33
34
    /**
35
     * Set API version
36
     *
37
     * @param string $value
38
     * @return $this
39
     */
40
    public function setVersion($value)
41
    {
42
        return $this->setParameter('version', $value);
43
    }
44
45
    /**
46
     * Get request text to analyze
47
     *
48
     * @return string
49
     */
50
    public function getText()
51
    {
52
        return $this->getParameter('text');
53
    }
54
55
    /**
56
     * Set request text to analyze
57
     *
58
     * @param string $value
59
     * @return $this
60
     */
61
    public function setText($value)
62
    {
63
        return $this->setParameter('text', $value);
64
    }
65
}
66