@@ 90-99 (lines=10) @@ | ||
87 | $requestParams = $request->getParsedBody(); |
|
88 | ||
89 | if (is_array($requestParams)) { |
|
90 | if (!$this->checkForDuplicateEmoji($requestParams['name'])) { |
|
91 | // Validate the user input fields |
|
92 | $validateResponse = $this->validateUserInput(['name','char','category','keywords',], $requestParams); |
|
93 | ||
94 | if (is_array($validateResponse)) { |
|
95 | return $response->withJson($validateResponse, 400); |
|
96 | } |
|
97 | return $this->runCreateEmoji($request, $response, $requestParams); |
|
98 | ||
99 | } |
|
100 | ||
101 | return $response->withJson(['message' => 'Emoji cannot be duplicated'], 400); |
|
102 | } |
|
@@ 145-152 (lines=8) @@ | ||
142 | if (is_array($upateParams)) { |
|
143 | $emoji = Emoji::find($args['id']); |
|
144 | ||
145 | if (count($emoji) > 0) { // Validate the user input fields |
|
146 | $validateResponse = $this->validateUserInput(['name','char','category',], $upateParams); |
|
147 | if (is_array($validateResponse)) { |
|
148 | return $response->withJson($validateResponse, 400); |
|
149 | } |
|
150 | ||
151 | return $this->runUpdateEmoji($emoji, $response, $updateParams); |
|
152 | } |
|
153 | ||
154 | return $response->withJson([ |
|
155 | 'message' => 'Record cannot be updated because the id supplied is invalid' |