Completed
Push — add-language-status ( 66aa42 )
by
unknown
04:03
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/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);
42
        $response = $request->send();
43
44
        return $response->getBody(true);
45
    }
46
}
47