nstack-io /
php-sdk
| 1 | <?php |
||
| 2 | |||
| 3 | namespace NStack\Clients; |
||
| 4 | |||
| 5 | use NStack\Exceptions\FailedToParseException; |
||
| 6 | use NStack\Models\IpAddress; |
||
| 7 | use NStack\Models\Proposal; |
||
| 8 | use NStack\Models\ProposalDeleted; |
||
|
0 ignored issues
–
show
|
|||
| 9 | |||
| 10 | /** |
||
| 11 | * Class ProposalsClient |
||
| 12 | * |
||
| 13 | * @package NStack\Clients |
||
| 14 | * @author Tiago Araujo <[email protected]> |
||
| 15 | */ |
||
| 16 | class ProposalsClient extends NStackClient |
||
| 17 | { |
||
| 18 | /** @var string */ |
||
| 19 | protected $path = 'localize/proposals'; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * index |
||
| 23 | * |
||
| 24 | * @param String|null $guid |
||
| 25 | * @return array |
||
| 26 | * @throws FailedToParseException |
||
| 27 | */ |
||
| 28 | 1 | public function index(String $guid = null): array |
|
| 29 | { |
||
| 30 | 1 | $response = $this->client->get($this->buildPath($this->path . '?guid=' . $guid)); |
|
| 31 | 1 | $contents = $response->getBody()->getContents(); |
|
| 32 | 1 | $data = json_decode($contents, true); |
|
| 33 | |||
| 34 | 1 | $array = []; |
|
| 35 | 1 | foreach ($data['data'] as $object) { |
|
| 36 | 1 | $array[] = new Proposal($object); |
|
| 37 | } |
||
| 38 | |||
| 39 | 1 | return $array; |
|
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * store |
||
| 44 | * |
||
| 45 | * @param String|null $guid |
||
| 46 | * @param String $key |
||
| 47 | * @param String $value |
||
| 48 | * @param String $platform |
||
| 49 | * @param String $locale |
||
| 50 | * @param String $section |
||
| 51 | * @return Proposal |
||
| 52 | * @throws FailedToParseException |
||
| 53 | */ |
||
| 54 | 1 | public function store( |
|
| 55 | String $guid, |
||
| 56 | String $key, |
||
| 57 | String $value, |
||
| 58 | String $platform, |
||
| 59 | String $locale, |
||
| 60 | String $section |
||
| 61 | ) |
||
| 62 | { |
||
| 63 | 1 | $response = $this->client->post($this->buildPath($this->path), [ |
|
| 64 | 'form_params' => [ |
||
| 65 | 1 | 'key' => $key, |
|
| 66 | 1 | 'value' => $value, |
|
| 67 | 1 | 'locale' => $locale, |
|
| 68 | 1 | 'platform' => $platform, |
|
| 69 | 1 | 'guid' => $guid, |
|
| 70 | 1 | 'section' => $section, |
|
| 71 | ] |
||
| 72 | ]); |
||
| 73 | 1 | $contents = $response->getBody()->getContents(); |
|
| 74 | 1 | $data = json_decode($contents, true); |
|
| 75 | 1 | return new Proposal($data['data']); |
|
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * delete |
||
| 80 | * |
||
| 81 | * @param int $id |
||
| 82 | * @param String $guid |
||
| 83 | */ |
||
| 84 | public function delete(int $id, String $guid) |
||
| 85 | { |
||
| 86 | $this->client->delete($this->buildPath($this->path . '/' . $id . '?guid=' . $guid)); |
||
| 87 | } |
||
| 88 | |||
| 89 | } |
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