Completed
Push — master ( 6d8a2a...3743ea )
by Byron
02:34
created

Detect::getRequestOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace badams\MicrosoftTranslator\Methods;
4
5
/**
6
 * Class Detect
7
 * @package badams\MicrosoftTranslator\Methods
8
 * @link https://msdn.microsoft.com/en-us/library/ff512411.aspx
9
 */
10
class Detect implements \badams\MicrosoftTranslator\ApiMethodInterface
11
{
12
    /**
13
     * @var string
14
     */
15
    protected $text;
16
17
    /**
18
     * Translate constructor.
19
     * @param $text
20
     * @param $to
21
     * @param null $from
0 ignored issues
show
Bug introduced by
There is no parameter named $from. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
22
     */
23 3
    public function __construct($text)
24
    {
25 3
        $this->text = $text;
26 3
    }
27
28
    /**
29
     * @return string
30
     */
31 3
    public function getRequestMethod()
32
    {
33 3
        return 'GET';
34
    }
35
36
    /**
37
     * @return array
38
     */
39 3
    public function getRequestOptions()
40
    {
41 3
        return ['query' => ['text' => $this->text]];
42
    }
43
44
    /**
45
     * @param \GuzzleHttp\Message\ResponseInterface $response
46
     * @return string
47
     */
48 3
    public function processResponse(\GuzzleHttp\Message\ResponseInterface $response)
49
    {
50 3
        $xml = (array)simplexml_load_string($response->getBody()->getContents());
51 3
        return (string)$xml[0];
52
    }
53
54
55
}