LanguageStatus   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 4
dl 0
loc 41
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setLanguage() 0 6 1
A getLanguage() 0 4 1
A execute() 0 12 1
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 string $language
18
     *
19
     * @return LanguageStatus
20
     */
21
    public function setLanguage($language)
22
    {
23
        $this->language = $language;
24
25
        return $this;
26
    }
27
28
    /**
29
     * @return string
30
     */
31
    public function getLanguage()
32
    {
33
        return $this->language;
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function execute()
40
    {
41
        $path = sprintf(
42
            "project/%s/language-status?key=%s",
43
            $this->client->getProjectIdentifier(),
44
            $this->client->getProjectApiKey()
45
        );
46
        $parameters = array_merge($this->parameters, ['form_params' => ['language' => $this->getLanguage()]]);
47
        $response   = $this->client->getHttpClient()->post($path, $parameters);
48
49
        return $response->getBody(true);
0 ignored issues
show
Unused Code introduced by
The call to ResponseInterface::getBody() has too many arguments starting with true.

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...
50
    }
51
}
52