Completed
Push — fix-checkstyle ( 525678...700890 )
by
unknown
03:06
created

Export   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 4
c 2
b 1
f 0
lcom 1
cbo 5
dl 0
loc 44
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 15 2
A getBranch() 0 4 1
A setBranch() 0 6 1
1
<?php
2
3
namespace Akeneo\Crowdin\Api;
4
5
/**
6
 * Build ZIP archive with the latest translations. Can be invoked only once for 30 minutes.
7
 *
8
 * @author Nicolas Dupont <[email protected]>
9
 * @see http://crowdin.net/page/api/export
10
 */
11
class Export extends AbstractApi
12
{
13
    /** @var string */
14
    protected $branch;
15
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function execute()
20
    {
21
        $path = sprintf(
22
            "project/%s/export?key=%s",
23
            $this->client->getProjectIdentifier(),
24
            $this->client->getProjectApiKey()
25
        );
26
        if (null !== $this->branch) {
27
            $path = sprintf('%s&branch=%s', $path, $this->branch);
28
        }
29
        $request  = $this->client->getHttpClient()->get($path);
30
        $response = $request->send();
31
32
        return $response->getBody(true);
33
    }
34
35
    /**
36
     * @return string
37
     */
38
    public function getBranch()
39
    {
40
        return $this->branch;
41
    }
42
43
    /**
44
     * @param string $branch
45
     *
46
     * @return Export
47
     */
48
    public function setBranch($branch)
49
    {
50
        $this->branch = $branch;
51
52
        return $this;
53
    }
54
}
55