| @@ 60-74 (lines=15) @@ | ||
| 57 | * @return CasesResponse |
|
| 58 | * @throws IncorrectUserEmailException |
|
| 59 | */ |
|
| 60 | public function add(AddCasesRequest $request) |
|
| 61 | { |
|
| 62 | $transformer = $this->transformerFactory->get(CasesDataTransformerFactory::REQUEST_ADD); |
|
| 63 | $configuration = $this->configurationFactory->get(CasesConfigurationFactory::CONFIGURATION_ADD); |
|
| 64 | ||
| 65 | try { |
|
| 66 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 67 | } catch (InvalidConfigurationException $exception) { |
|
| 68 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 69 | } |
|
| 70 | ||
| 71 | $result = $this->requestService->postMultipart('cases', 'case', $params); |
|
| 72 | ||
| 73 | return $this->transformerFactory->get(CasesDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * @param EditCasesRequest $request |
|
| @@ 110-124 (lines=15) @@ | ||
| 107 | * @param ListCasesRequest $request |
|
| 108 | * @return GetCasesResponse |
|
| 109 | */ |
|
| 110 | public function lists(ListCasesRequest $request) |
|
| 111 | { |
|
| 112 | $transformer = $this->transformerFactory->get(CasesDataTransformerFactory::REQUEST_LIST); |
|
| 113 | $configuration = $this->configurationFactory->get(CasesConfigurationFactory::CONFIGURATION_LIST); |
|
| 114 | ||
| 115 | try { |
|
| 116 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 117 | } catch (InvalidConfigurationException $exception) { |
|
| 118 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 119 | } |
|
| 120 | ||
| 121 | $result = $this->requestService->get('cases', $params); |
|
| 122 | ||
| 123 | return $this->transformerFactory->get(CasesDataTransformerFactory::RESPONSE_LIST)->transform($result); |
|
| 124 | } |
|
| 125 | ||
| 126 | /** |
|
| 127 | * @param ViewCasesRequest $request |
|
| @@ 130-144 (lines=15) @@ | ||
| 127 | * @param ViewCasesRequest $request |
|
| 128 | * @return CasesResponse |
|
| 129 | */ |
|
| 130 | public function view(ViewCasesRequest $request) |
|
| 131 | { |
|
| 132 | $transformer = $this->transformerFactory->get(CasesDataTransformerFactory::REQUEST_VIEW); |
|
| 133 | $configuration = $this->configurationFactory->get(CasesConfigurationFactory::CONFIGURATION_VIEW); |
|
| 134 | ||
| 135 | try { |
|
| 136 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 137 | } catch (InvalidConfigurationException $exception) { |
|
| 138 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 139 | } |
|
| 140 | ||
| 141 | $result = $this->requestService->get("cases/{$params['case_id']}"); |
|
| 142 | ||
| 143 | return $this->transformerFactory->get(CasesDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 144 | } |
|
| 145 | ||
| 146 | /** |
|
| 147 | * @param ViewCasesRequest $request |
|
| @@ 151-165 (lines=15) @@ | ||
| 148 | * @return CasesResponse |
|
| 149 | * @throws CasesNotFoundException |
|
| 150 | */ |
|
| 151 | public function trash(ViewCasesRequest $request) |
|
| 152 | { |
|
| 153 | $transformer = $this->transformerFactory->get(CasesDataTransformerFactory::REQUEST_VIEW); |
|
| 154 | $configuration = $this->configurationFactory->get(CasesConfigurationFactory::CONFIGURATION_VIEW); |
|
| 155 | ||
| 156 | try { |
|
| 157 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 158 | } catch (InvalidConfigurationException $exception) { |
|
| 159 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 160 | } |
|
| 161 | ||
| 162 | $result = $this->requestService->put("cases/{$params['case_id']}/trash"); |
|
| 163 | ||
| 164 | return $this->transformerFactory->get(CasesDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 165 | } |
|
| 166 | ||
| 167 | /** |
|
| 168 | * @param ViewCasesRequest $request |
|
| @@ 172-186 (lines=15) @@ | ||
| 169 | * @return CasesResponse |
|
| 170 | * @throws CasesNotFoundException |
|
| 171 | */ |
|
| 172 | public function spam(ViewCasesRequest $request) |
|
| 173 | { |
|
| 174 | $transformer = $this->transformerFactory->get(CasesDataTransformerFactory::REQUEST_VIEW); |
|
| 175 | $configuration = $this->configurationFactory->get(CasesConfigurationFactory::CONFIGURATION_VIEW); |
|
| 176 | ||
| 177 | try { |
|
| 178 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 179 | } catch (InvalidConfigurationException $exception) { |
|
| 180 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 181 | } |
|
| 182 | ||
| 183 | $result = $this->requestService->put("cases/{$params['case_id']}/spam"); |
|
| 184 | ||
| 185 | return $this->transformerFactory->get(CasesDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 186 | } |
|
| 187 | ||
| 188 | /** |
|
| 189 | * @param ViewCasesRequest $request |
|
| @@ 193-207 (lines=15) @@ | ||
| 190 | * @return CasesResponse |
|
| 191 | * @throws CasesNotFoundException |
|
| 192 | */ |
|
| 193 | public function restore(ViewCasesRequest $request) |
|
| 194 | { |
|
| 195 | $transformer = $this->transformerFactory->get(CasesDataTransformerFactory::REQUEST_VIEW); |
|
| 196 | $configuration = $this->configurationFactory->get(CasesConfigurationFactory::CONFIGURATION_VIEW); |
|
| 197 | ||
| 198 | try { |
|
| 199 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 200 | } catch (InvalidConfigurationException $exception) { |
|
| 201 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 202 | } |
|
| 203 | ||
| 204 | $result = $this->requestService->put("cases/{$params['case_id']}/restore"); |
|
| 205 | ||
| 206 | return $this->transformerFactory->get(CasesDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 207 | } |
|
| 208 | ||
| 209 | /** |
|
| 210 | * @param ViewCasesRequest $request |
|
| @@ 55-69 (lines=15) @@ | ||
| 52 | * @param AddGroupRequest $request |
|
| 53 | * @return GroupResponse |
|
| 54 | */ |
|
| 55 | public function add(AddGroupRequest $request) |
|
| 56 | { |
|
| 57 | $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_ADD); |
|
| 58 | $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_ADD); |
|
| 59 | ||
| 60 | try { |
|
| 61 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 62 | } catch (InvalidConfigurationException $exception) { |
|
| 63 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 64 | } |
|
| 65 | ||
| 66 | $result = $this->requestService->post('groups', ['group' => $params]); |
|
| 67 | ||
| 68 | return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** |
|
| 72 | * @param EditGroupRequest $request |
|
| @@ 75-89 (lines=15) @@ | ||
| 72 | * @param EditGroupRequest $request |
|
| 73 | * @return GroupResponse |
|
| 74 | */ |
|
| 75 | public function edit(EditGroupRequest $request) |
|
| 76 | { |
|
| 77 | $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_EDIT); |
|
| 78 | $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_EDIT); |
|
| 79 | ||
| 80 | try { |
|
| 81 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 82 | } catch (InvalidConfigurationException $exception) { |
|
| 83 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 84 | } |
|
| 85 | ||
| 86 | $result = $this->requestService->put("groups/{$params['group_id']}", ['group' => $params]); |
|
| 87 | ||
| 88 | return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 89 | } |
|
| 90 | ||
| 91 | /** |
|
| 92 | * @param ListGroupRequest $request |
|
| @@ 95-109 (lines=15) @@ | ||
| 92 | * @param ListGroupRequest $request |
|
| 93 | * @return GetGroupResponse |
|
| 94 | */ |
|
| 95 | public function lists(ListGroupRequest $request) |
|
| 96 | { |
|
| 97 | $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_LIST); |
|
| 98 | $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_LIST); |
|
| 99 | ||
| 100 | try { |
|
| 101 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 102 | } catch (InvalidConfigurationException $exception) { |
|
| 103 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 104 | } |
|
| 105 | ||
| 106 | $result = $this->requestService->get('groups', $params); |
|
| 107 | ||
| 108 | return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_LIST)->transform($result); |
|
| 109 | } |
|
| 110 | ||
| 111 | /** |
|
| 112 | * @param ViewGroupRequest $request |
|
| @@ 115-129 (lines=15) @@ | ||
| 112 | * @param ViewGroupRequest $request |
|
| 113 | * @return GroupResponse |
|
| 114 | */ |
|
| 115 | public function view(ViewGroupRequest $request) |
|
| 116 | { |
|
| 117 | $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_VIEW); |
|
| 118 | $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_VIEW); |
|
| 119 | ||
| 120 | try { |
|
| 121 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 122 | } catch (InvalidConfigurationException $exception) { |
|
| 123 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 124 | } |
|
| 125 | ||
| 126 | $result = $this->requestService->get("groups/{$params['group_id']}"); |
|
| 127 | ||
| 128 | return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 129 | } |
|
| 130 | ||
| 131 | /** |
|
| 132 | * @param ViewGroupRequest $request |
|
| @@ 135-149 (lines=15) @@ | ||
| 132 | * @param ViewGroupRequest $request |
|
| 133 | * @return GroupResponse |
|
| 134 | */ |
|
| 135 | public function disable(ViewGroupRequest $request) |
|
| 136 | { |
|
| 137 | $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_VIEW); |
|
| 138 | $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_VIEW); |
|
| 139 | ||
| 140 | try { |
|
| 141 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 142 | } catch (InvalidConfigurationException $exception) { |
|
| 143 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 144 | } |
|
| 145 | ||
| 146 | $result = $this->requestService->put("groups/{$params['group_id']}/disable"); |
|
| 147 | ||
| 148 | return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 149 | } |
|
| 150 | ||
| 151 | /** |
|
| 152 | * @param ViewGroupRequest $request |
|
| @@ 155-169 (lines=15) @@ | ||
| 152 | * @param ViewGroupRequest $request |
|
| 153 | * @return GroupResponse |
|
| 154 | */ |
|
| 155 | public function enable(ViewGroupRequest $request) |
|
| 156 | { |
|
| 157 | $transformer = $this->transformerFactory->get(GroupDataTransformerFactory::REQUEST_VIEW); |
|
| 158 | $configuration = $this->configurationFactory->get(GroupConfigurationFactory::CONFIGURATION_VIEW); |
|
| 159 | ||
| 160 | try { |
|
| 161 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 162 | } catch (InvalidConfigurationException $exception) { |
|
| 163 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 164 | } |
|
| 165 | ||
| 166 | $result = $this->requestService->put("groups/{$params['group_id']}/enable"); |
|
| 167 | ||
| 168 | return $this->transformerFactory->get(GroupDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 169 | } |
|
| 170 | ||
| 171 | /** |
|
| 172 | * @param ViewGroupRequest $request |
|
| @@ 90-104 (lines=15) @@ | ||
| 87 | * @param ListMessageRequest $request |
|
| 88 | * @return ListMessageResponse |
|
| 89 | */ |
|
| 90 | public function lists(ListMessageRequest $request) |
|
| 91 | { |
|
| 92 | $transformer = $this->transformerFactory->get(MessageDataTransformerFactory::REQUEST_LIST); |
|
| 93 | $configuration = $this->configurationFactory->get(MessageConfigurationFactory::CONFIGURATION_LIST); |
|
| 94 | ||
| 95 | try { |
|
| 96 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 97 | } catch (InvalidConfigurationException $exception) { |
|
| 98 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 99 | } |
|
| 100 | ||
| 101 | $result = $this->requestService->get("cases/{$params['case_id']}/messages", $params); |
|
| 102 | ||
| 103 | return $this->transformerFactory->get(MessageDataTransformerFactory::RESPONSE_LIST)->transform($result); |
|
| 104 | } |
|
| 105 | } |
|
| 106 | ||
| @@ 89-103 (lines=15) @@ | ||
| 86 | * @param EditStaffRequest $request |
|
| 87 | * @return StaffResponse |
|
| 88 | */ |
|
| 89 | public function edit(EditStaffRequest $request) |
|
| 90 | { |
|
| 91 | $transformer = $this->transformerFactory->get(StaffDataTransformerFactory::REQUEST_EDIT); |
|
| 92 | $configuration = $this->configurationFactory->get(StaffConfigurationFactory::CONFIGURATION_EDIT); |
|
| 93 | ||
| 94 | try { |
|
| 95 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 96 | } catch (InvalidConfigurationException $exception) { |
|
| 97 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 98 | } |
|
| 99 | ||
| 100 | $result = $this->requestService->put("staff/{$params['staff_id']}", $params); |
|
| 101 | ||
| 102 | return $this->transformerFactory->get(StaffDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 103 | } |
|
| 104 | ||
| 105 | /** |
|
| 106 | * @param ListStaffRequest $request |
|
| @@ 109-123 (lines=15) @@ | ||
| 106 | * @param ListStaffRequest $request |
|
| 107 | * @return ListStaffResponse |
|
| 108 | */ |
|
| 109 | public function lists(ListStaffRequest $request) |
|
| 110 | { |
|
| 111 | $transformer = $this->transformerFactory->get(StaffDataTransformerFactory::REQUEST_LIST); |
|
| 112 | $configuration = $this->configurationFactory->get(StaffConfigurationFactory::CONFIGURATION_LIST); |
|
| 113 | ||
| 114 | try { |
|
| 115 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 116 | } catch (InvalidConfigurationException $exception) { |
|
| 117 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 118 | } |
|
| 119 | ||
| 120 | $result = $this->requestService->get('staff', $params); |
|
| 121 | ||
| 122 | return $this->transformerFactory->get(StaffDataTransformerFactory::RESPONSE_LIST)->transform($result); |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * @param ViewStaffRequest $request |
|
| @@ 129-143 (lines=15) @@ | ||
| 126 | * @param ViewStaffRequest $request |
|
| 127 | * @return StaffResponse |
|
| 128 | */ |
|
| 129 | public function view(ViewStaffRequest $request) |
|
| 130 | { |
|
| 131 | $transformer = $this->transformerFactory->get(StaffDataTransformerFactory::REQUEST_VIEW); |
|
| 132 | $configuration = $this->configurationFactory->get(StaffConfigurationFactory::CONFIGURATION_VIEW); |
|
| 133 | ||
| 134 | try { |
|
| 135 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 136 | } catch (InvalidConfigurationException $exception) { |
|
| 137 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 138 | } |
|
| 139 | ||
| 140 | $result = $this->requestService->get("staff/{$params['staff_id']}"); |
|
| 141 | ||
| 142 | return $this->transformerFactory->get(StaffDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 143 | } |
|
| 144 | ||
| 145 | /** |
|
| 146 | * @param ViewStaffRequest $request |
|
| @@ 149-163 (lines=15) @@ | ||
| 146 | * @param ViewStaffRequest $request |
|
| 147 | * @return StaffResponse |
|
| 148 | */ |
|
| 149 | public function disable(ViewStaffRequest $request) |
|
| 150 | { |
|
| 151 | $transformer = $this->transformerFactory->get(StaffDataTransformerFactory::REQUEST_VIEW); |
|
| 152 | $configuration = $this->configurationFactory->get(StaffConfigurationFactory::CONFIGURATION_VIEW); |
|
| 153 | ||
| 154 | try { |
|
| 155 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 156 | } catch (InvalidConfigurationException $exception) { |
|
| 157 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 158 | } |
|
| 159 | ||
| 160 | $result = $this->requestService->put("staff/{$params['staff_id']}/disable"); |
|
| 161 | ||
| 162 | return $this->transformerFactory->get(StaffDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 163 | } |
|
| 164 | ||
| 165 | /** |
|
| 166 | * @param ViewStaffRequest $request |
|
| @@ 169-183 (lines=15) @@ | ||
| 166 | * @param ViewStaffRequest $request |
|
| 167 | * @return StaffResponse |
|
| 168 | */ |
|
| 169 | public function enable(ViewStaffRequest $request) |
|
| 170 | { |
|
| 171 | $transformer = $this->transformerFactory->get(StaffDataTransformerFactory::REQUEST_VIEW); |
|
| 172 | $configuration = $this->configurationFactory->get(StaffConfigurationFactory::CONFIGURATION_VIEW); |
|
| 173 | ||
| 174 | try { |
|
| 175 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 176 | } catch (InvalidConfigurationException $exception) { |
|
| 177 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 178 | } |
|
| 179 | ||
| 180 | $result = $this->requestService->put("staff/{$params['staff_id']}/enable"); |
|
| 181 | ||
| 182 | return $this->transformerFactory->get(StaffDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 183 | } |
|
| 184 | ||
| 185 | /** |
|
| 186 | * @param ViewStaffRequest $request |
|
| @@ 97-111 (lines=15) @@ | ||
| 94 | * @param EditUserRequest $request |
|
| 95 | * @return UserResponse |
|
| 96 | */ |
|
| 97 | public function edit(EditUserRequest $request) |
|
| 98 | { |
|
| 99 | $transformer = $this->transformerFactory->get(UserDataTransformerFactory::REQUEST_EDIT); |
|
| 100 | $configuration = $this->configurationFactory->get(UserConfigurationFactory::CONFIGURATION_EDIT); |
|
| 101 | ||
| 102 | try { |
|
| 103 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 104 | } catch (InvalidConfigurationException $exception) { |
|
| 105 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 106 | } |
|
| 107 | ||
| 108 | $result = $this->requestService->put("users/{$params['user_id']}", ['user' => $params]); |
|
| 109 | ||
| 110 | return $this->transformerFactory->get(UserDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * @param ListUserRequest $request |
|
| @@ 117-131 (lines=15) @@ | ||
| 114 | * @param ListUserRequest $request |
|
| 115 | * @return ListUserResponse |
|
| 116 | */ |
|
| 117 | public function lists(ListUserRequest $request) |
|
| 118 | { |
|
| 119 | $transformer = $this->transformerFactory->get(UserDataTransformerFactory::REQUEST_LIST); |
|
| 120 | $configuration = $this->configurationFactory->get(UserConfigurationFactory::CONFIGURATION_LIST); |
|
| 121 | ||
| 122 | try { |
|
| 123 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 124 | } catch (InvalidConfigurationException $exception) { |
|
| 125 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 126 | } |
|
| 127 | ||
| 128 | $result = $this->requestService->get('users', $params); |
|
| 129 | ||
| 130 | return $this->transformerFactory->get(UserDataTransformerFactory::RESPONSE_LIST)->transform($result); |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * @param ViewUserRequest $request |
|
| @@ 137-151 (lines=15) @@ | ||
| 134 | * @param ViewUserRequest $request |
|
| 135 | * @return UserResponse |
|
| 136 | */ |
|
| 137 | public function view(ViewUserRequest $request) |
|
| 138 | { |
|
| 139 | $transformer = $this->transformerFactory->get(UserDataTransformerFactory::REQUEST_VIEW); |
|
| 140 | $configuration = $this->configurationFactory->get(UserConfigurationFactory::CONFIGURATION_VIEW); |
|
| 141 | ||
| 142 | try { |
|
| 143 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 144 | } catch (InvalidConfigurationException $exception) { |
|
| 145 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 146 | } |
|
| 147 | ||
| 148 | $result = $this->requestService->get("users/{$params['user_id']}"); |
|
| 149 | ||
| 150 | return $this->transformerFactory->get(UserDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 151 | } |
|
| 152 | ||
| 153 | /** |
|
| 154 | * @param ViewUserRequest $request |
|
| @@ 157-171 (lines=15) @@ | ||
| 154 | * @param ViewUserRequest $request |
|
| 155 | * @return UserResponse |
|
| 156 | */ |
|
| 157 | public function block(ViewUserRequest $request) |
|
| 158 | { |
|
| 159 | $transformer = $this->transformerFactory->get(UserDataTransformerFactory::REQUEST_VIEW); |
|
| 160 | $configuration = $this->configurationFactory->get(UserConfigurationFactory::CONFIGURATION_VIEW); |
|
| 161 | ||
| 162 | try { |
|
| 163 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 164 | } catch (InvalidConfigurationException $exception) { |
|
| 165 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 166 | } |
|
| 167 | ||
| 168 | $result = $this->requestService->put("users/{$params['user_id']}/block"); |
|
| 169 | ||
| 170 | return $this->transformerFactory->get(UserDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 171 | } |
|
| 172 | ||
| 173 | /** |
|
| 174 | * @param ViewUserRequest $request |
|
| @@ 177-191 (lines=15) @@ | ||
| 174 | * @param ViewUserRequest $request |
|
| 175 | * @return UserResponse |
|
| 176 | */ |
|
| 177 | public function restore(ViewUserRequest $request) |
|
| 178 | { |
|
| 179 | $transformer = $this->transformerFactory->get(UserDataTransformerFactory::REQUEST_VIEW); |
|
| 180 | $configuration = $this->configurationFactory->get(UserConfigurationFactory::CONFIGURATION_VIEW); |
|
| 181 | ||
| 182 | try { |
|
| 183 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 184 | } catch (InvalidConfigurationException $exception) { |
|
| 185 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 186 | } |
|
| 187 | ||
| 188 | $result = $this->requestService->put("users/{$params['user_id']}/restore"); |
|
| 189 | ||
| 190 | return $this->transformerFactory->get(UserDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 191 | } |
|
| 192 | ||
| 193 | /** |
|
| 194 | * @param ViewUserRequest $request |
|
| @@ 197-211 (lines=15) @@ | ||
| 194 | * @param ViewUserRequest $request |
|
| 195 | * @return UserResponse |
|
| 196 | */ |
|
| 197 | public function disable(ViewUserRequest $request) |
|
| 198 | { |
|
| 199 | $transformer = $this->transformerFactory->get(UserDataTransformerFactory::REQUEST_VIEW); |
|
| 200 | $configuration = $this->configurationFactory->get(UserConfigurationFactory::CONFIGURATION_VIEW); |
|
| 201 | ||
| 202 | try { |
|
| 203 | $params = $this->checkRequest($request, $transformer, $configuration); |
|
| 204 | } catch (InvalidConfigurationException $exception) { |
|
| 205 | throw new InvalidConfigurationException($exception->getMessage()); |
|
| 206 | } |
|
| 207 | ||
| 208 | $result = $this->requestService->put("users/{$params['user_id']}/disable"); |
|
| 209 | ||
| 210 | return $this->transformerFactory->get(UserDataTransformerFactory::RESPONSE_VIEW)->transform($result); |
|
| 211 | } |
|
| 212 | ||
| 213 | /** |
|
| 214 | * @param ViewUserRequest $request |
|