| Conditions | 7 | 
| Paths | 10 | 
| Total Lines | 24 | 
| Code Lines | 12 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 14 | 
| CRAP Score | 7.0145 | 
| Changes | 2 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 52 | 4 | public function __invoke(Request $request, Response $response, $args) | |
| 53 | 	{ | ||
| 54 | 4 | $body = $request->getParsedBody(); | |
| 55 | 4 | 		if ( ! isset($body['object_kind'])) { | |
| 56 | 1 | return $response->withStatus(500); | |
| 57 | } | ||
| 58 | |||
| 59 | 3 | 		foreach ($request->getHeader('X-Gitlab-Token') as $secret) { | |
| 60 | 3 | 			if ($secret === $this->secret) { | |
| 61 | 3 | $this->secured = TRUE; | |
| 62 | 3 | } | |
| 63 | 3 | } | |
| 64 | |||
| 65 | 3 | 		if ($this->secret !== NULL && ! $this->secured) { | |
| 66 | return $response->withStatus(403); | ||
| 67 | } | ||
| 68 | |||
| 69 | 3 | 		if (isset($this->router[$body['object_kind']])) { | |
| 70 | 3 | $this->router[$body['object_kind']]($body); | |
| 71 | 3 | } | |
| 72 | |||
| 73 | |||
| 74 | 3 | return $response->withStatus(200); | |
| 75 | } | ||
| 76 | |||
| 78 | 
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: