1 | <?php |
||
2 | |||
3 | namespace NStack\Clients; |
||
4 | |||
5 | use NStack\Exceptions\FailedToParseException; |
||
6 | use NStack\Models\Proposal; |
||
7 | use NStack\Models\ProposalDeleted; |
||
0 ignored issues
–
show
|
|||
8 | |||
9 | /** |
||
10 | * Class ProposalsClient |
||
11 | * |
||
12 | * @package NStack\Clients |
||
13 | * @author Tiago Araujo <[email protected]> |
||
14 | */ |
||
15 | class ProposalsClient extends NStackClient |
||
16 | { |
||
17 | /** @var string */ |
||
18 | protected $path = 'localize/proposals'; |
||
19 | |||
20 | /** |
||
21 | * index |
||
22 | * |
||
23 | * @param String|null $guid |
||
24 | * @return array |
||
25 | * @throws FailedToParseException |
||
26 | */ |
||
27 | 1 | public function index(String $guid = null): array |
|
28 | { |
||
29 | 1 | $response = $this->client->get($this->buildPath($this->path . '?guid=' . $guid)); |
|
30 | 1 | $contents = $response->getBody()->getContents(); |
|
31 | 1 | $data = json_decode($contents, true); |
|
32 | |||
33 | 1 | $array = []; |
|
34 | 1 | foreach ($data['data'] as $object) { |
|
35 | 1 | $array[] = new Proposal($object); |
|
36 | } |
||
37 | |||
38 | 1 | return $array; |
|
39 | } |
||
40 | |||
41 | /** |
||
42 | * store |
||
43 | * |
||
44 | * @param String|null $guid |
||
45 | * @param String $key |
||
46 | * @param String $value |
||
47 | * @param String $platform |
||
48 | * @param String $locale |
||
49 | * @param String $section |
||
50 | * @return Proposal |
||
51 | * @throws FailedToParseException |
||
52 | */ |
||
53 | 1 | public function store( |
|
54 | String $guid, |
||
55 | String $key, |
||
56 | String $value, |
||
57 | String $platform, |
||
58 | String $locale, |
||
59 | String $section |
||
60 | ) { |
||
61 | 1 | $response = $this->client->post($this->buildPath($this->path), [ |
|
62 | 'form_params' => [ |
||
63 | 1 | 'key' => $key, |
|
64 | 1 | 'value' => $value, |
|
65 | 1 | 'locale' => $locale, |
|
66 | 1 | 'platform' => $platform, |
|
67 | 1 | 'guid' => $guid, |
|
68 | 1 | 'section' => $section, |
|
69 | ], |
||
70 | ]); |
||
71 | 1 | $contents = $response->getBody()->getContents(); |
|
72 | 1 | $data = json_decode($contents, true); |
|
73 | |||
74 | 1 | return new Proposal($data['data']); |
|
75 | } |
||
76 | |||
77 | /** |
||
78 | * delete |
||
79 | * |
||
80 | * @param int $id |
||
81 | * @param String $guid |
||
82 | */ |
||
83 | public function delete(int $id, String $guid) |
||
84 | { |
||
85 | $this->client->delete($this->buildPath($this->path . '/' . $id . '?guid=' . $guid)); |
||
86 | } |
||
87 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths