Export   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 29
ccs 0
cts 11
cp 0
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A locale() 0 14 3
1
<?php
2
3
/*
4
 *
5
 *
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license.  See the LICENSE file for details.
8
 */
9
10
namespace FAPI\Localise\Api;
11
12
use Psr\Http\Message\ResponseInterface;
13
use FAPI\Localise\Exception;
14
15
/**
16
 * @author Tobias Nyholm <[email protected]>
17
 */
18
class Export extends HttpApi
19
{
20
    /**
21
     * Export a locale.
22
     * {@link https://localise.biz/api/docs/export/exportlocale}.
23
     *
24
     * @param string $projectKey
25
     * @param string $locale
26
     * @param string $ext
27
     * @param array  $params
28
     *
29
     * @return string|ResponseInterface
30
     *
31
     * @throws Exception
32
     */
33
    public function locale(string $projectKey, string $locale, string $ext, array $params)
34
    {
35
        $params['key'] = $projectKey;
36
        $response = $this->httpGet(sprintf('/api/export/locale/%s.%s?%s', $locale, $ext, http_build_query($params)));
37
38
        if (!$this->hydrator) {
39
            return $response;
40
        }
41
42
        if (200 !== $response->getStatusCode()) {
43
            $this->handleErrors($response);
44
        }
45
46
        return (string) $response->getBody();
47
    }
48
}
49