| Total Complexity | 4 |
| Total Lines | 60 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class UserOrganizations |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var Client |
||
| 16 | */ |
||
| 17 | private $client; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var Csv |
||
| 21 | */ |
||
| 22 | private $csv; |
||
| 23 | |||
| 24 | 1 | public function __construct(Client $client, Csv $csv) |
|
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Get organizations and titles of user |
||
| 32 | * https://cybozudev.zendesk.com/hc/ja/articles/202124774#step2 |
||
| 33 | * |
||
| 34 | * @param string $code |
||
| 35 | * @return array |
||
| 36 | */ |
||
| 37 | 1 | public function get($code): array |
|
| 38 | { |
||
| 39 | 1 | $options = ['json' => ['code' => $code]]; |
|
| 40 | |||
| 41 | /** @var JsonStream $stream */ |
||
| 42 | 1 | $stream = $this->client |
|
| 43 | 1 | ->get(UserApi::generateUrl('user/organizations.json'), $options) |
|
| 44 | 1 | ->getBody(); |
|
| 45 | |||
| 46 | 1 | return $stream->jsonSerialize()['organizationTitles']; |
|
| 47 | } |
||
| 48 | |||
| 49 | /** |
||
| 50 | * Get userOrganizations by csv |
||
| 51 | * https://cybozudev.zendesk.com/hc/ja/articles/202124774#step1 |
||
| 52 | * |
||
| 53 | * @return string |
||
| 54 | * @throws \InvalidArgumentException |
||
| 55 | */ |
||
| 56 | 1 | public function getByCsv(): string |
|
| 59 | } |
||
| 60 | |||
| 61 | /** |
||
| 62 | * Post userOrganizations by csv |
||
| 63 | * https://cybozudev.zendesk.com/hc/ja/articles/202362860 |
||
| 64 | * |
||
| 65 | * @param $filename |
||
| 66 | * @return int |
||
| 67 | * @throws \InvalidArgumentException |
||
| 68 | */ |
||
| 69 | 1 | public function postByCsv($filename): int |
|
| 72 | } |
||
| 73 | } |
||
| 74 |