Completed
Pull Request — master (#40)
by
unknown
09:36 queued 07:49
created

LanguageStatus::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 13
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
namespace Akeneo\Crowdin\Api;
4
5
/**
6
 * Project translation progress by language
7
 *
8
 * @author Pierre Allard <[email protected]>
9
 * @see http://crowdin.net/page/api/language-status
10
 */
11
class LanguageStatus extends AbstractApi
12
{
13
    /** @var string */
14
    protected $language;
15
16
    /**
17
     * @param $language
18
     */
19
    public function setLanguage($language) {
20
        $this->language = $language;
21
    }
22
23
    /**
24
     * @return string
25
     */
26
    public function getLanguage() {
27
        return $this->language;
28
    }
29
30
    /**
31
     * {@inheritdoc}
32
     */
33
    public function execute()
34
    {
35
        $path = sprintf(
36
            "project/%s/language-status?key=%s",
37
            $this->client->getProjectIdentifier(),
38
            $this->client->getProjectApiKey()
39
        );
40
        $parameters = array_merge($this->parameters, ['language' => $this->getLanguage()]);
41
        $request  = $this->client->getHttpClient()->post($path, [], $parameters);
0 ignored issues
show
Unused Code introduced by
The call to Client::post() has too many arguments starting with $parameters.

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...
42
        $response = $request->send();
0 ignored issues
show
Bug introduced by
The method send() does not seem to exist on object<Psr\Http\Message\ResponseInterface>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
43
44
        return $response->getBody(true);
45
    }
46
}
47