| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 51 | 3 | public function set($key = '', $value = '') { |
|
| 52 | 3 | $response = new JSONResponse(); |
|
| 53 | |||
| 54 | 3 | if($key === '' || $value === '') { |
|
| 55 | 1 | $response->setStatus(Http::STATUS_PRECONDITION_FAILED); |
|
| 56 | 1 | return $response; |
|
| 57 | } |
||
| 58 | |||
| 59 | try { |
||
| 60 | 2 | $this->config->setUserValue($this->userId, $this->appName, $key, $value); |
|
| 61 | 1 | $response->setData([ |
|
| 62 | 1 | 'key' => $key, |
|
| 63 | 1 | 'value' => $value, |
|
| 64 | 1 | ]); |
|
| 65 | 1 | return $response; |
|
| 66 | 1 | } catch (\Exception $e) { |
|
| 67 | 1 | $response->setStatus(Http::STATUS_INTERNAL_SERVER_ERROR); |
|
| 68 | 1 | return $response; |
|
| 69 | } |
||
| 70 | } |
||
| 71 | } |
||
| 72 |
This check marks parameter names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString.